diff --git a/doc/images/qmldesigner-export-item-button.png b/doc/images/qmldesigner-export-item-button.png new file mode 100644 index 00000000000..b8bf8b0f394 Binary files /dev/null and b/doc/images/qmldesigner-export-item-button.png differ diff --git a/doc/images/qmldesigner-export-item.png b/doc/images/qmldesigner-export-item.png new file mode 100644 index 00000000000..83ba7b1afca Binary files /dev/null and b/doc/images/qmldesigner-export-item.png differ diff --git a/doc/images/qtcreator-analyze-menu.png b/doc/images/qtcreator-analyze-menu.png index 9c5035cc0a7..71ceb4e8cdd 100644 Binary files a/doc/images/qtcreator-analyze-menu.png and b/doc/images/qtcreator-analyze-menu.png differ diff --git a/doc/images/qtcreator-build-steps.png b/doc/images/qtcreator-build-steps.png index a1f717e50bc..5a44ac1d015 100644 Binary files a/doc/images/qtcreator-build-steps.png and b/doc/images/qtcreator-build-steps.png differ diff --git a/doc/images/qtcreator-clang-static-analyzer-options.png b/doc/images/qtcreator-clang-static-analyzer-options.png new file mode 100644 index 00000000000..89d0d0c622c Binary files /dev/null and b/doc/images/qtcreator-clang-static-analyzer-options.png differ diff --git a/doc/images/qtcreator-clang-static-analyzer.png b/doc/images/qtcreator-clang-static-analyzer.png new file mode 100644 index 00000000000..6d6eecbd4c2 Binary files /dev/null and b/doc/images/qtcreator-clang-static-analyzer.png differ diff --git a/doc/src/analyze/creator-analyze.qdoc b/doc/src/analyze/creator-analyze.qdoc index d0a760c3b2f..afaa994fcf4 100644 --- a/doc/src/analyze/creator-analyze.qdoc +++ b/doc/src/analyze/creator-analyze.qdoc @@ -59,6 +59,12 @@ You can detect problems in memory management by using the Memcheck tool and find cache misses in the code by using the Callgrind tool. + \li \l{Using Clang Static Analyzer}{Clang Static Analyzer} + + In \QC Enterprise, you can detect problems in C, C++, and + Objective-C programs by using the experimental plugin that + integrates the Clang Static Analyzer source code analysis tool. + \endlist */ diff --git a/doc/src/analyze/creator-clang-static-analyzer.qdoc b/doc/src/analyze/creator-clang-static-analyzer.qdoc new file mode 100644 index 00000000000..0a3d4fe0ffd --- /dev/null +++ b/doc/src/analyze/creator-clang-static-analyzer.qdoc @@ -0,0 +1,77 @@ + +/**************************************************************************** +** +** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator +** +** +** GNU Free Documentation License +** +** 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. +** +** +****************************************************************************/ + +// ********************************************************************** +// NOTE: the sections are not ordered by their logical order to avoid +// reshuffling the file each time the index order changes (i.e., often). +// Run the fixnavi.pl script to adjust the links to the index order. +// ********************************************************************** + +/*! + \contentspage {Qt Creator Manual} + \previouspage creator-running-valgrind-remotely.html + \page creator-clang-static-analyzer.html + \nextpage creator-advanced.html + + \title Using Clang Static Analyzer + + \QC Enterprise integrates the \l{http://clang-analyzer.llvm.org} + {Clang Static Analyzer} for finding problems in C, C++, and Objective-C + programs. You must have Clang installed to use the plugin. At the time of + this writing, the plugin is experimental and only available on Linux and + OS X. + + \image qtcreator-clang-static-analyzer.png + + The Clang Static Analyzer runs with all the default checkers enabled. For + more information about the checkers, see + \l{http://clang-analyzer.llvm.org/available_checks.html}{Available Checkers}. + + To set up the Clang Static Analyzer: + + \list 1 + + \li Select \gui Help > \gui {About Plugins} > \gui {Code Analyzer} > + \gui {Clang Static Analyzer} to enable the experimental plugin. + + \li Restart \QC to be able to use the plugin. + + \li Select \gui Tools > \gui Options > \gui Analyzer > + \gui {Clang Static Analyzer} to check that the path to the Clang + executable is set correctly in the \gui {Clang executable} field. + + \image qtcreator-clang-static-analyzer-options.png + + \endlist + + To run the Clang Static Analyzer to analyze an open project: + + \list 1 + + \li Select \gui Analyze > \gui {Clang Static Analyzer}. + + \li Select the + \inlineimage qtcreator-analyze-start-button.png + (\gui Start) button to run the Clang Static Analyzer on the + application. + + \endlist + +*/ + diff --git a/doc/src/analyze/creator-valgrind.qdoc b/doc/src/analyze/creator-valgrind.qdoc index 6b475066b3d..d01229b8a32 100644 --- a/doc/src/analyze/creator-valgrind.qdoc +++ b/doc/src/analyze/creator-valgrind.qdoc @@ -254,7 +254,7 @@ \contentspage {Qt Creator Manual} \previouspage creator-cache-profiler.html \page creator-running-valgrind-remotely.html - \nextpage creator-advanced.html + \nextpage creator-clang-static-analyzer.html \title Running Valgrind Tools on External Applications diff --git a/doc/src/editors/creator-editors.qdoc b/doc/src/editors/creator-editors.qdoc index 975de5d5b14..6f89e849e54 100644 --- a/doc/src/editors/creator-editors.qdoc +++ b/doc/src/editors/creator-editors.qdoc @@ -528,6 +528,56 @@ \li Qt Quick Designer only supports states in the root QML type \li + \row + \li M208 + \li Error + \li This type (%1) is not supported as a root element by \QMLD. + \li + + \row + \li M220 + \li Error + \li This type (%1) is not supported as a root element of a Qt Quick UI + form. + \li + + \row + \li M221 + \li Error + \li This type (%1) is not supported in a Qt Quick UI form. + \li + + \row + \li M222 + \li Error + \li Functions are not supported in a Qt Quick UI form. + \li + + \row + \li M223 + \li Error + \li Java Script blocks are not supported in a Qt Quick UI form. + \li + + \row + \li M224 + \li Error + \li Behavior type is not supported in a Qt Quick UI form. + \li + + \row + \li M225 + \li Error + \li States are only supported in the root item in a Qt Quick UI form. + \li + + \row + \li M226 + \li Error + \li Referencing the parent of the root item is not supported in a Qt + Quick UI form. + \li + \row \li M300 \li Error @@ -671,6 +721,12 @@ \li 'Number' elements expected in array value \li + \row + \li M324 + \li Warning + \li Using Qt Quick 1 code model instead of Qt Quick 2 + \li + \endtable */ diff --git a/doc/src/howto/creator-vcs.qdoc b/doc/src/howto/creator-vcs.qdoc index 02abcec556b..3b29a6e4ef1 100644 --- a/doc/src/howto/creator-vcs.qdoc +++ b/doc/src/howto/creator-vcs.qdoc @@ -65,7 +65,7 @@ \row \li Subversion \li \l{http://subversion.apache.org/} - \li Subversion version 1.6.17 and later + \li Subversion version 1.7.0 and later \endtable \section1 Setting Up Version Control Systems diff --git a/doc/src/overview/creator-advanced.qdoc b/doc/src/overview/creator-advanced.qdoc index 8c5a5e6e450..d3767fd756f 100644 --- a/doc/src/overview/creator-advanced.qdoc +++ b/doc/src/overview/creator-advanced.qdoc @@ -24,7 +24,7 @@ /*! \contentspage {Qt Creator Manual} - \previouspage creator-running-valgrind-remotely.html + \previouspage creator-clang-static-analyzer.html \page creator-advanced.html \nextpage creator-os-supported-platforms.html diff --git a/doc/src/projects/creator-projects-settings-build.qdoc b/doc/src/projects/creator-projects-settings-build.qdoc index 029ea38fed5..9c26a672d5e 100644 --- a/doc/src/projects/creator-projects-settings-build.qdoc +++ b/doc/src/projects/creator-projects-settings-build.qdoc @@ -120,6 +120,15 @@ the build step and add a custom build step that specifies another shell command. + \QC Enterprise is integrated to \l{http://doc.qt.digia.com/QtQuickCompiler/} + {Qt Quick Compiler}. It is a commercial add-on for Qt Quick applications + that enables you to compile QML source code into the final binary. This + improves the startup time of the application and eliminates the need to + deploy QML files together with the application. \QC new project wizards + create projects that the Qt Quick Compiler can compile, because they are + set up to use the Qt Resource System. To compile Qt Quick projects, select + the \gui {Enable Qt Quick Compiler} check box. + \note For more information about the build steps when using Qbs, see \l{Building Applications with Qbs}. diff --git a/doc/src/qtcreator.qdoc b/doc/src/qtcreator.qdoc index 319f9d8e2b8..4960869b375 100644 --- a/doc/src/qtcreator.qdoc +++ b/doc/src/qtcreator.qdoc @@ -254,6 +254,7 @@ \li \l{Profiling Function Execution} \li \l{Running Valgrind Tools on External Applications} \endlist + \li \l{Using Clang Static Analyzer} \endlist \endlist diff --git a/share/qtcreator/debugger/creatortypes.py b/share/qtcreator/debugger/creatortypes.py index 75d3be59cdb..2c36166a382 100644 --- a/share/qtcreator/debugger/creatortypes.py +++ b/share/qtcreator/debugger/creatortypes.py @@ -117,10 +117,10 @@ def qdump__CPlusPlus__Token(d, value): k = value["f"]["kind"] if int(k) == 6: d.putValue("T_IDENTIFIER. offset: %d, len: %d" - % (value["offset"], value["f"]["length"])) + % (value["utf16charOffset"], value["f"]["utf16chars"])) elif int(k) == 7: - d.putValue("T_NUMERIC_LITERAL. offset: %d, value: %d" - % (value["offset"], value["f"]["length"])) + d.putValue("T_NUMERIC_LITERAL. offset: %d, len: %d" + % (value["utf16charOffset"], value["f"]["utf16chars"])) else: val = str(k.cast(d.lookupType("CPlusPlus::Kind"))) d.putValue(val[11:]) # Strip "CPlusPlus::" diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp index 8e0b6f9603d..b93a5e4de24 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp @@ -49,24 +49,15 @@ #include #endif -int main(int argc, char *argv[]) +int internalMain(QGuiApplication *application) { - // Since we always render text into an FBO, we need to globally disable - // subpixel antialiasing and instead use gray. - qputenv("QSG_DISTANCEFIELD_ANTIALIASING", "gray"); -#ifdef Q_OS_MAC //This keeps qml2puppet from stealing focus - qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "true"); -#endif - - QApplication application(argc, argv); - QCoreApplication::setOrganizationName("QtProject"); QCoreApplication::setOrganizationDomain("qt-project.org"); QCoreApplication::setApplicationName("Qml2Puppet"); QCoreApplication::setApplicationVersion("1.0.0"); - if (application.arguments().count() < 2 - || (application.arguments().at(1) == "--readcapturedstream" && application.arguments().count() < 3)) { + if (application->arguments().count() < 2 + || (application->arguments().at(1) == "--readcapturedstream" && application->arguments().count() < 3)) { qDebug() << "Usage:\n"; qDebug() << "--test"; qDebug() << "--version"; @@ -75,16 +66,16 @@ int main(int argc, char *argv[]) return -1; } - if (application.arguments().at(1) == "--readcapturedstream" && application.arguments().count() > 2) { - QFileInfo inputStreamFileInfo(application.arguments().at(2)); + if (application->arguments().at(1) == "--readcapturedstream" && application->arguments().count() > 2) { + QFileInfo inputStreamFileInfo(application->arguments().at(2)); if (!inputStreamFileInfo.exists()) { qDebug() << "Input stream does not exist:" << inputStreamFileInfo.absoluteFilePath(); return -1; } - if (application.arguments().count() > 3) { - QFileInfo controlStreamFileInfo(application.arguments().at(3)); + if (application->arguments().count() > 3) { + QFileInfo controlStreamFileInfo(application->arguments().at(3)); if (!controlStreamFileInfo.exists()) { qDebug() << "Output stream does not exist:" << controlStreamFileInfo.absoluteFilePath(); @@ -93,7 +84,7 @@ int main(int argc, char *argv[]) } } - if (application.arguments().count() == 2 && application.arguments().at(1) == "--test") { + if (application->arguments().count() == 2 && application->arguments().at(1) == "--test") { qDebug() << QCoreApplication::applicationVersion(); QQmlEngine engine; @@ -112,13 +103,13 @@ int main(int argc, char *argv[]) return 0; } - if (application.arguments().count() == 2 && application.arguments().at(1) == "--version") { + if (application->arguments().count() == 2 && application->arguments().at(1) == "--version") { std::cout << 2; return 0; } - if (application.arguments().at(1) != "--readcapturedstream" && application.arguments().count() < 4) { - qDebug() << "Wrong argument count: " << application.arguments().count(); + if (application->arguments().at(1) != "--readcapturedstream" && application->arguments().count() < 4) { + qDebug() << "Wrong argument count: " << application->arguments().count(); return -1; } @@ -128,14 +119,36 @@ int main(int argc, char *argv[]) QtSystemExceptionHandler systemExceptionHandler; #endif - new QmlDesigner::Qt5NodeInstanceClientProxy(&application); + new QmlDesigner::Qt5NodeInstanceClientProxy(application); #if defined(Q_OS_WIN) && defined(QT_NO_DEBUG) SetErrorMode(SEM_NOGPFAULTERRORBOX); //We do not want to see any message boxes #endif - if (application.arguments().at(1) == "--readcapturedstream") + if (application->arguments().at(1) == "--readcapturedstream") return 0; - return application.exec(); + return application->exec(); +} + +int main(int argc, char *argv[]) +{ + // Since we always render text into an FBO, we need to globally disable + // subpixel antialiasing and instead use gray. + qputenv("QSG_DISTANCEFIELD_ANTIALIASING", "gray"); +#ifdef Q_OS_OSX //This keeps qml2puppet from stealing focus + qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "true"); +#endif + + //If a style different from Desktop is set we have to use QGuiApplication + bool useGuiApplication = !qgetenv("QT_QUICK_CONTROLS_STYLE").isEmpty() + && qgetenv("QT_QUICK_CONTROLS_STYLE") != "Desktop"; + + if (useGuiApplication) { + QGuiApplication application(argc, argv); + return internalMain(&application); + } else { + QApplication application(argc, argv); + return internalMain(&application); + } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml index daf30934561..d6168f0952b 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml @@ -43,7 +43,7 @@ Item { signal clicked() - property alias toolTip: toolTipArea.toolTip + property alias tooltip: toolTipArea.tooltip width: 24 + leftPadding height: 24 diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml index 2b166723b45..44801ea4782 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml @@ -199,7 +199,7 @@ Column { colorEditor.backendValue.resetValue() gradientLine.deleteGradient() } - toolTip: qsTr("Solid Color") + tooltip: qsTr("Solid Color") } ButtonRowButton { visible: supportGradient @@ -209,7 +209,7 @@ Column { gradientLine.addGradient() } - toolTip: qsTr("Gradient") + tooltip: qsTr("Gradient") } ButtonRowButton { iconSource: "images/icon_color_none.png" @@ -217,7 +217,7 @@ Column { colorEditor.color = "#00000000" gradientLine.deleteGradient() } - toolTip: qsTr("Transparent") + tooltip: qsTr("Transparent") } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml index 9a0388bf195..9254f2262a3 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml @@ -30,7 +30,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 as Controls -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls.Styles 1.2 ComboBoxStyle { property color borderColor: "#222" @@ -106,4 +106,11 @@ ComboBoxStyle { color: textColor } } + + __dropDownStyle: MenuStyle { + __maxPopupHeight: 600 + __menuItemType: "comboboxitem" + frame: Rectangle { + } + } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FlickableSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FlickableSection.qml index 269126ec6ac..021780bb108 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FlickableSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FlickableSection.qml @@ -98,7 +98,7 @@ Section { Label { text: qsTr("Behavior") - toolTip: qsTr("Bounds behavior") + tooltip: qsTr("Bounds behavior") } SecondColumnLayout { @@ -126,7 +126,7 @@ Section { Label { text: qsTr("Max. velocity") - toolTip: qsTr("Maximum flick velocity") + tooltip: qsTr("Maximum flick velocity") } SecondColumnLayout { @@ -143,7 +143,7 @@ Section { Label { text: qsTr("Deceleration") - toolTip: qsTr("Flick deceleration") + tooltip: qsTr("Flick deceleration") } SecondColumnLayout { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Label.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Label.qml index 54833d24de1..9583930d41e 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Label.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Label.qml @@ -36,7 +36,7 @@ import QtQuick.Controls.Private 1.0 Controls.Label { id: label - property alias toolTip: toolTipArea.toolTip + property alias tooltip: toolTipArea.tooltip width: Math.max(Math.min(240, parent.width - 220), 80) color: "#eee" @@ -49,6 +49,6 @@ Controls.Label { ToolTipArea { id: toolTipArea anchors.fill: parent - toolTip: label.text + tooltip: label.text } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ToolTipArea.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ToolTipArea.qml index 9bc53b77b3c..57355f54830 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ToolTipArea.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ToolTipArea.qml @@ -41,11 +41,11 @@ MouseArea { hoverEnabled: true - property string toolTip + property string tooltip Timer { interval: 1000 - running: mouseArea.containsMouse && toolTip.length - onTriggered: Tooltip.showText(mouseArea, Qt.point(mouseArea.mouseX, mouseArea.mouseY), toolTip) + running: mouseArea.containsMouse && tooltip.length + onTriggered: Tooltip.showText(mouseArea, Qt.point(mouseArea.mouseX, mouseArea.mouseY), tooltip) } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml index 6e611d6bfe4..a5a589e512f 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml @@ -50,7 +50,7 @@ Column { Label { text: qsTr("Cache") - toolTip: qsTr("Cache buffer") + tooltip: qsTr("Cache buffer") } SectionLayout { @@ -117,7 +117,7 @@ Column { Label { text: qsTr("Navigation wraps") - toolTip: qsTr("Determines whether the grid wraps key navigation.") + tooltip: qsTr("Determines whether the grid wraps key navigation.") } SectionLayout { @@ -145,7 +145,7 @@ Column { Label { text: qsTr("Snap mode") - toolTip: qsTr("Determines how the view scrolling will settle following a drag or flick.") + tooltip: qsTr("Determines how the view scrolling will settle following a drag or flick.") } SecondColumnLayout { @@ -169,7 +169,7 @@ Column { Label { text: qsTr("Range") - toolTip: qsTr("Highlight range") + tooltip: qsTr("Highlight range") } SecondColumnLayout { @@ -184,7 +184,7 @@ Column { Label { text: qsTr("Move duration") - toolTip: qsTr("Move animation duration of the highlight delegate.") + tooltip: qsTr("Move animation duration of the highlight delegate.") } SectionLayout { @@ -202,7 +202,7 @@ Column { Label { text: qsTr("Move speed") - toolTip: qsTr("Move animation speed of the highlight delegate.") + tooltip: qsTr("Move animation speed of the highlight delegate.") } SectionLayout { @@ -220,7 +220,7 @@ Column { Label { text: qsTr("Preferred begin") - toolTip: qsTr("Preferred highlight begin - must be smaller than Preferred end.") + tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end.") } SectionLayout { @@ -238,7 +238,7 @@ Column { Label { text: qsTr("Preferred end") - toolTip: qsTr("Preferred highlight end - must be larger than Preferred begin.") + tooltip: qsTr("Preferred highlight end - must be larger than Preferred begin.") } SectionLayout { @@ -256,7 +256,7 @@ Column { Label { text: qsTr("Follows current") - toolTip: qsTr("Determines whether the highlight is managed by the view.") + tooltip: qsTr("Determines whether the highlight is managed by the view.") } SectionLayout { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml index df998572d84..7325ae918f3 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml @@ -50,7 +50,7 @@ Column { Label { text: qsTr("Cache") - toolTip: qsTr("Cache buffer") + tooltip: qsTr("Cache buffer") } SectionLayout { @@ -68,7 +68,7 @@ Column { Label { text: qsTr("Navigation wraps") - toolTip: qsTr("Determines whether the grid wraps key navigation.") + tooltip: qsTr("Determines whether the grid wraps key navigation.") } SectionLayout { @@ -83,7 +83,7 @@ Column { Label { text: qsTr("Orientation") - toolTip: qsTr("Orientation of the list.") + tooltip: qsTr("Orientation of the list.") } SecondColumnLayout { @@ -114,7 +114,7 @@ Column { Label { text: qsTr("Snap mode") - toolTip: qsTr("Determines how the view scrolling will settle following a drag or flick.") + tooltip: qsTr("Determines how the view scrolling will settle following a drag or flick.") } SecondColumnLayout { @@ -131,7 +131,7 @@ Column { Label { text: qsTr("Spacing") - toolTip: qsTr("Spacing between items.") + tooltip: qsTr("Spacing between items.") } SectionLayout { @@ -159,7 +159,7 @@ Column { Label { text: qsTr("Range") - toolTip: qsTr("Highlight range") + tooltip: qsTr("Highlight range") } SecondColumnLayout { @@ -178,7 +178,7 @@ Column { Label { text: qsTr("Move duration") - toolTip: qsTr("Move animation duration of the highlight delegate.") + tooltip: qsTr("Move animation duration of the highlight delegate.") } SectionLayout { @@ -196,7 +196,7 @@ Column { Label { text: qsTr("Move speed") - toolTip: qsTr("Move animation speed of the highlight delegate.") + tooltip: qsTr("Move animation speed of the highlight delegate.") } SectionLayout { @@ -214,7 +214,7 @@ Column { Label { text: qsTr("Resize duration") - toolTip: qsTr("Resize animation duration of the highlight delegate.") + tooltip: qsTr("Resize animation duration of the highlight delegate.") } SectionLayout { @@ -232,7 +232,7 @@ Column { Label { text: qsTr("Preferred begin") - toolTip: qsTr("Preferred highlight begin - must be smaller than Preferred end.") + tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end.") } SectionLayout { @@ -250,7 +250,7 @@ Column { Label { text: qsTr("Preferred end") - toolTip: qsTr("Preferred highlight end - must be larger than Preferred begin.") + tooltip: qsTr("Preferred highlight end - must be larger than Preferred begin.") } SectionLayout { @@ -268,7 +268,7 @@ Column { Label { text: qsTr("Follows current") - toolTip: qsTr("Determines whether the highlight is managed by the view.") + tooltip: qsTr("Determines whether the highlight is managed by the view.") } SectionLayout { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml index eca582f0cfb..a47cd5aad1c 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml @@ -44,7 +44,7 @@ Column { SectionLayout { Label { text: qsTr("Enabled") - toolTip: qsTr("This property holds whether the item accepts mouse events.") + tooltip: qsTr("This property holds whether the item accepts mouse events.") } SecondColumnLayout { @@ -59,7 +59,7 @@ Column { Label { text: qsTr("Hover Enabled") - toolTip: qsTr("This property holds whether hover events are handled.") + tooltip: qsTr("This property holds whether hover events are handled.") } SecondColumnLayout { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PathViewSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PathViewSpecifics.qml index 41e43e88a64..9d7ef5c84ad 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PathViewSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PathViewSpecifics.qml @@ -45,7 +45,7 @@ Column { Label { text: qsTr("Drag margin") - toolTip: qsTr("Drag margin") + tooltip: qsTr("Drag margin") } SecondColumnLayout { @@ -80,7 +80,7 @@ Column { Label { text: qsTr("Interactive") - toolTip: qsTr("A user cannot drag or flick a PathView that is not interactive.") + tooltip: qsTr("A user cannot drag or flick a PathView that is not interactive.") } SecondColumnLayout { @@ -95,7 +95,7 @@ Column { Label { text: qsTr("Offset") - toolTip: qsTr("Specifies how far along the path the items are from their initial positions. This is a real number that ranges from 0.0 to the count of items in the model.") + tooltip: qsTr("Specifies how far along the path the items are from their initial positions. This is a real number that ranges from 0.0 to the count of items in the model.") } SecondColumnLayout { @@ -113,7 +113,7 @@ Column { Label { text: qsTr("Item count") - toolTip: qsTr("pathItemCount: number of items visible on the path at any one time.") + tooltip: qsTr("pathItemCount: number of items visible on the path at any one time.") } SecondColumnLayout { @@ -139,7 +139,7 @@ Column { Label { text: qsTr("Range") - toolTip: qsTr("Highlight range") + tooltip: qsTr("Highlight range") } SecondColumnLayout { @@ -158,7 +158,7 @@ Column { Label { text: qsTr("Move duration") - toolTip: qsTr("Move animation duration of the highlight delegate.") + tooltip: qsTr("Move animation duration of the highlight delegate.") } SecondColumnLayout { @@ -176,7 +176,7 @@ Column { Label { text: qsTr("Preferred begin") - toolTip: qsTr("Preferred highlight begin - must be smaller than Preferred end. Note that the user has to add a highlight component.") + tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end. Note that the user has to add a highlight component.") } SecondColumnLayout { @@ -194,7 +194,7 @@ Column { Label { text: qsTr("Preferred end") - toolTip: qsTr("Preferred highlight end - must be larger than Preferred begin. Note that the user has to add a highlight component.") + tooltip: qsTr("Preferred highlight end - must be larger than Preferred begin. Note that the user has to add a highlight component.") } SecondColumnLayout { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml index 1e45f1ff788..da48d952e54 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml @@ -73,7 +73,7 @@ Section { Label { visible: textInputSection.isTextInput text: qsTr("Pass. char") - toolTip: qsTr("Character displayed when users enter passwords.") + tooltip: qsTr("Character displayed when users enter passwords.") } LineEdit { diff --git a/share/qtcreator/qmldesigner/propertyeditor/HelperWidgets/qmldir b/share/qtcreator/qmldesigner/propertyeditor/HelperWidgets/qmldir deleted file mode 100644 index 25a7d544442..00000000000 --- a/share/qtcreator/qmldesigner/propertyeditor/HelperWidgets/qmldir +++ /dev/null @@ -1,48 +0,0 @@ -AlignmentHorizontalButtons 1.0 AlignmentHorizontalButtons.qml -AlignmentVerticalButtons 1.0 AlignmentVerticalButtons.qml -AnchorBox 1.0 AnchorBox.qml -AnchorButtons 1.0 AnchorButtons.qml -CheckBox 1.0 CheckBox.qml -ColorGroupBox 1.0 ColorGroupBox.qml -ColorLabel 1.0 ColorLabel.qml -ColorLineEdit 1.0 ColorLineEdit.qml -ColorScheme 1.0 ColorScheme.qml -ColorTypeButtons 1.0 ColorTypeButtons.qml -ComboBox 1.0 ComboBox.qml -DoubleSpinBox 1.0 DoubleSpinBox.qml -DoubleSpinBoxAlternate 1.0 DoubleSpinBoxAlternate.qml -ExpressionEditor 1.0 ExpressionEditor.qml -Extended 1.0 Extended.qml -ExtendedFunctionButton 1.0 ExtendedFunctionButton.qml -ExtendedPane 1.0 ExtendedPane.qml -ExtendedSwitches 1.0 ExtendedSwitches.qml -FlagedButton 1.0 FlagedButton.qml -FontComboBox 1.0 FontComboBox.qml -FontGroupBox 1.0 FontGroupBox.qml -FontStyleButtons 1.0 FontStyleButtons.qml -Geometry 1.0 Geometry.qml -GroupBox 1.0 GroupBox.qml -GroupBoxOption 1.0 GroupBoxOption.qml -HorizontalLayout 1.0 HorizontalLayout.qml -HorizontalWhiteLine 1.0 HorizontalWhiteLine.qml -IntEditor 1.0 IntEditor.qml -Label 1.0 Label.qml -Layout 1.0 Layout.qml -LayoutPane 1.0 LayoutPane.qml -LineEdit 1.0 LineEdit.qml -Modifiers 1.0 Modifiers.qml -PlaceHolder 1.0 PlaceHolder.qml -PropertyFrame 1.0 PropertyFrame.qml -ScrollArea 1.0 ScrollArea.qml -SliderWidget 1.0 SliderWidget.qml -SpinBox 1.0 SpinBox.qml -StandardTextColorGroupBox 1.0 StandardTextColorGroupBox.qml -StandardTextGroupBox 1.0 StandardTextGroupBox.qml -Switches 1.0 Switches.qml -TextEditor 1.0 TextEditor.qml -TextInputGroupBox 1.0 TextInputGroupBox.qml -Transformation 1.0 Transformation.qml -Type 1.0 Type.qml -VerticalLayout 1.0 VerticalLayout.qml -Visibility 1.0 Visibility.qml -UrlEdit 1.0 UrlEdit.qml diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/MainForm.ui.qml b/share/qtcreator/templates/qtquick/qtquick_2_4/MainForm.ui.qml new file mode 100644 index 00000000000..2e696443642 --- /dev/null +++ b/share/qtcreator/templates/qtquick/qtquick_2_4/MainForm.ui.qml @@ -0,0 +1,18 @@ +import QtQuick 2.3 + +Rectangle { + property alias mouseArea: mouseArea + + width: 360 + height: 360 + + MouseArea { + id: mouseArea + anchors.fill: parent + } + + Text { + anchors.centerIn: parent + text: "Hello World" + } +} diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml b/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml index adf7a674464..cc82a9271cb 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml +++ b/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml @@ -3,18 +3,11 @@ import QtQuick.Window 2.2 Window { visible: true - width: 360 - height: 360 - - MouseArea { + MainForm { anchors.fill: parent - onClicked: { + mouseArea.onClicked: { Qt.quit(); } - } - Text { - text: qsTr("Hello World") - anchors.centerIn: parent } } diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc b/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc index 5f6483ac33f..7684346a52b 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc +++ b/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc @@ -1,5 +1,6 @@ main.qml + MainForm.ui.qml diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml index 7ae7e86f7ef..4e0f06de227 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml +++ b/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml @@ -1,8 +1,8 @@ diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/MainForm.ui.qml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/MainForm.ui.qml new file mode 100644 index 00000000000..e557debb83b --- /dev/null +++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/MainForm.ui.qml @@ -0,0 +1,31 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + +Item { + width: 640 + height: 480 + + property alias button3: button3 + property alias button2: button2 + property alias button1: button1 + + RowLayout { + anchors.centerIn: parent + + Button { + id: button1 + text: qsTr("Press Me 1") + } + + Button { + id: button2 + text: qsTr("Press Me 2") + } + + Button { + id: button3 + text: qsTr("Press Me 3") + } + } +} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml index 69a744993a2..e09bc3d47c7 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml +++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml @@ -1,28 +1,42 @@ import QtQuick 2.4 import QtQuick.Controls 1.3 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 ApplicationWindow { - visible: true + title: qsTr("Hello World") width: 640 height: 480 - title: qsTr("Hello World") + visible: true menuBar: MenuBar { Menu { - title: qsTr("File") + title: qsTr("&File") MenuItem { text: qsTr("&Open") - onTriggered: console.log("Open action triggered"); + onTriggered: messageDialog.show(qsTr("Open action triggered")); } MenuItem { - text: qsTr("Exit") + text: qsTr("E&xit") onTriggered: Qt.quit(); } } } - Text { - text: qsTr("Hello World") - anchors.centerIn: parent + MainForm { + anchors.fill: parent + button1.onClicked: messageDialog.show(qsTr("Button 1 pressed")) + button2.onClicked: messageDialog.show(qsTr("Button 2 pressed")) + button3.onClicked: messageDialog.show(qsTr("Button 3 pressed")) + } + + MessageDialog { + id: messageDialog + title: qsTr("May I have your attention, please?") + + function show(caption) { + messageDialog.text = caption; + messageDialog.open(); + } } } diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc index 5f6483ac33f..7684346a52b 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc +++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc @@ -1,5 +1,6 @@ main.qml + MainForm.ui.qml diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml index e278d73e82b..288bc02c8f9 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml +++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml @@ -1,8 +1,8 @@ diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.cpp b/share/qtcreator/templates/wizards/classes/cpp/file.cpp index 7d4833dcd07..85b45fe4324 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/file.cpp +++ b/share/qtcreator/templates/wizards/classes/cpp/file.cpp @@ -1,17 +1,14 @@ -%{Cpp:LicenseTemplate} - +%{Cpp:LicenseTemplate}\ #include "%{HdrFileName}" - %{JS: Cpp.openNamespaces('%{Class}')} @if '%{IncludeQSharedData}' - class %{CN}Data : public QSharedData { public: }; -@endif +@endif @if '%{Base}' === 'QObject' %{CN}::%{CN}(QObject *parent) : QObject(parent)%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''} @elsif '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow' @@ -41,5 +38,4 @@ public: { } - -%{JS: Cpp.closeNamespaces('%{Class}')} +%{JS: Cpp.closeNamespaces('%{Class}')}\ diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.h b/share/qtcreator/templates/wizards/classes/cpp/file.h index 74f21d7c376..91c2533b99a 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/file.h +++ b/share/qtcreator/templates/wizards/classes/cpp/file.h @@ -1,4 +1,4 @@ -%{Cpp:LicenseTemplate} +%{Cpp:LicenseTemplate}\ #ifndef %{GUARD} #define %{GUARD} @@ -12,10 +12,8 @@ ( '%{IncludeQMainWindow}' ) ? 'QtWidgets/%{IncludeQMainWindow}' : '', ( '%{IncludeQDeclarativeItem}' ) ? 'QtQuick1/%{IncludeQDeclarativeItem}' : '', ( '%{IncludeQQuickItem}' ) ? 'QtDeclarative/%{IncludeQQuickItem}' : '', - ( '%{IncludeQSharedData}' ) ? 'QtCore/QSharedDataPointer' : '' ])} - + ( '%{IncludeQSharedData}' ) ? 'QtCore/QSharedDataPointer' : '' ])}\ %{JS: Cpp.openNamespaces('%{Class}')} - @if '%{IncludeQSharedData}' class %{CN}Data; @@ -28,13 +26,13 @@ class %{CN} { @if '%{isQObject}' Q_OBJECT +@endif public: +@if '%{Base}' === 'QObject' explicit %{CN}(QObject *parent = 0); @elsif '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow' -public explicit %{CN}(QWidget *parent = 0); @else -public: %{CN}(); @endif @if '%{IncludeQSharedData}' @@ -54,7 +52,5 @@ private: QSharedDataPointer<%{CN}Data> data; @endif }; - %{JS: Cpp.closeNamespaces('%{Class}')} - -#endif // %{GUARD} +#endif // %{GUARD}\ diff --git a/share/qtcreator/templates/wizards/files/cppheader/file.h b/share/qtcreator/templates/wizards/files/cppheader/file.h index c8861f8c52f..d77576943e6 100644 --- a/share/qtcreator/templates/wizards/files/cppheader/file.h +++ b/share/qtcreator/templates/wizards/files/cppheader/file.h @@ -1,4 +1,4 @@ -%{Cpp:LicenseTemplate} +%{Cpp:LicenseTemplate}\ #ifndef %{JS: Cpp.headerGuard('%{FileName}')} #define %{JS: Cpp.headerGuard('%{FileName}')} diff --git a/share/qtcreator/templates/wizards/files/cppsource/file.cpp b/share/qtcreator/templates/wizards/files/cppsource/file.cpp index d6b739152fd..b6e652a44a6 100644 --- a/share/qtcreator/templates/wizards/files/cppsource/file.cpp +++ b/share/qtcreator/templates/wizards/files/cppsource/file.cpp @@ -1 +1 @@ -%{Cpp:LicenseTemplate} +%{Cpp:LicenseTemplate}\ diff --git a/share/qtcreator/templates/wizards/files/qrc/file.qrc b/share/qtcreator/templates/wizards/files/qrc/file.qrc index 807350da3bf..7646d2b36ca 100644 --- a/share/qtcreator/templates/wizards/files/qrc/file.qrc +++ b/share/qtcreator/templates/wizards/files/qrc/file.qrc @@ -1,2 +1 @@ - diff --git a/share/qtcreator/templates/wizards/global/guiapplication.png b/share/qtcreator/templates/wizards/global/guiapplication.png new file mode 100644 index 00000000000..c121959d9e2 Binary files /dev/null and b/share/qtcreator/templates/wizards/global/guiapplication.png differ diff --git a/share/qtcreator/templates/wizards/projects/qmake/empty/file.pro b/share/qtcreator/templates/wizards/projects/qmake/empty/file.pro new file mode 100644 index 00000000000..e69de29bb2d diff --git a/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json new file mode 100644 index 00000000000..17d39e79b34 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json @@ -0,0 +1,52 @@ +{ + "version": 1, + "kind": "project", + "id": "U.QtEmpty", + "category": "H.Project", + "trDescription": "Creates a qmake-based project without any files. This allows you to create an application without any default classes.", + "trDisplayName": "Empty qmake Project", + "trDisplayCategory": "Other Project", + "icon": "../../../global/guiapplication.png", + "featuresRequired": [ "Plugin.QmakeProjectManager", "QtSupport.Wizards.FeatureQt" ], + + "options": + [ + { "key": "ProFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, + { "key": "IsTopLevelProject", "value": "%{JS: ('%{Exists:ProjectExplorer.Profile.Ids}') ? '' : 'yes'}" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project" + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "enabled": "%{IsTopLevelProject}", + "data": { "projectFilePath": "%{ProFileName}" } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "file.pro", + "target": "%{ProFileName}", + "openAsProject": true + } + ] + } + ] +} diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme index 774222439a4..3eb1628fd1c 100644 --- a/share/qtcreator/themes/dark.creatortheme +++ b/share/qtcreator/themes/dark.creatortheme @@ -1,5 +1,6 @@ [General] ThemeName=dark +PreferredStyles=Fusion [Palette] shadowBackground=ff232323 @@ -108,6 +109,7 @@ DrawIndicatorBranch=true DrawProgressBarSunken=false DrawSearchResultWidgetFrame=false DrawTargetSelectorBottom=false +ApplyThemePaletteGlobally=true [Gradients] DetailsWidgetHeaderGradient\1\color=0 diff --git a/share/qtcreator/themes/default.creatortheme b/share/qtcreator/themes/default.creatortheme index d2dc35fc6c7..5149e83162e 100644 --- a/share/qtcreator/themes/default.creatortheme +++ b/share/qtcreator/themes/default.creatortheme @@ -1,5 +1,6 @@ [General] ThemeName=default +PreferredStyles= [Palette] brightText = ffffffff @@ -102,6 +103,7 @@ DrawIndicatorBranch=false DrawProgressBarSunken=true DrawSearchResultWidgetFrame=true DrawTargetSelectorBottom=true +ApplyThemePaletteGlobally=false [Gradients] DetailsWidgetHeaderGradient\1\color=ffffff diff --git a/src/app/Info.plist.in b/src/app/Info.plist.in index 6bbfcc3a020..a0c2b39ff79 100644 --- a/src/app/Info.plist.in +++ b/src/app/Info.plist.in @@ -248,5 +248,7 @@ $$QTCREATOR_VERSION CFBundleShortVersionString $$QTCREATOR_VERSION + LSMinimumSystemVersion + 10.7.0 diff --git a/src/libs/3rdparty/cplusplus/LiteralTable.cpp b/src/libs/3rdparty/cplusplus/LiteralTable.cpp deleted file mode 100644 index 5934872aced..00000000000 --- a/src/libs/3rdparty/cplusplus/LiteralTable.cpp +++ /dev/null @@ -1,2 +0,0 @@ - -#include "LiteralTable.h" diff --git a/src/libs/3rdparty/cplusplus/cplusplus.pri b/src/libs/3rdparty/cplusplus/cplusplus.pri index fac71294527..14f8ce3a04b 100644 --- a/src/libs/3rdparty/cplusplus/cplusplus.pri +++ b/src/libs/3rdparty/cplusplus/cplusplus.pri @@ -51,7 +51,6 @@ SOURCES += \ $$PWD/ObjectiveCAtKeywords.cpp \ $$PWD/ObjectiveCTypeQualifiers.cpp \ $$PWD/Lexer.cpp \ - $$PWD/LiteralTable.cpp \ $$PWD/Literals.cpp \ $$PWD/MemoryPool.cpp \ $$PWD/Name.cpp \ diff --git a/src/libs/cplusplus/cplusplus.qbs b/src/libs/cplusplus/cplusplus.qbs index 51b70ce5baf..e4db761e042 100644 --- a/src/libs/cplusplus/cplusplus.qbs +++ b/src/libs/cplusplus/cplusplus.qbs @@ -44,7 +44,6 @@ QtcLibrary { "Keywords.cpp", "Lexer.cpp", "Lexer.h", - "LiteralTable.cpp", "LiteralTable.h", "Literals.cpp", "Literals.h", diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 9083952305c..eb097694126 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -1557,7 +1557,10 @@ bool Check::visit(CallExpression *ast) && name != QLatin1String("Boolean") && name != QLatin1String("Date") && name != QLatin1String("Number") - && name != QLatin1String("Object")) { + && name != QLatin1String("Object") + && name != QLatin1String("QT_TR_NOOP") + && name != QLatin1String("QT_TRANSLATE_NOOP") + && name != QLatin1String("QT_TRID_NOOP")) { addMessage(WarnExpectedNewWithUppercaseFunction, location); } if (cast(ast->base) && name == QLatin1String("eval")) diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp index 19628bae9af..7658bb27753 100644 --- a/src/libs/qmljs/qmljsscopebuilder.cpp +++ b/src/libs/qmljs/qmljsscopebuilder.cpp @@ -67,26 +67,27 @@ void ScopeBuilder::push(AST::Node *node) // JS signal handler scope if (UiScriptBinding *script = cast(node)) { QString name; - if (script->qualifiedId) + if (script->qualifiedId) { name = script->qualifiedId->name.toString(); - if (!_scopeChain->qmlScopeObjects().isEmpty() - && name.startsWith(QLatin1String("on")) - && !script->qualifiedId->next) { - const ObjectValue *owner = 0; - const Value *value = 0; - // try to find the name on the scope objects - foreach (const ObjectValue *scope, _scopeChain->qmlScopeObjects()) { - value = scope->lookupMember(name, _scopeChain->context(), &owner); - if (value) - break; - } - // signals defined in QML - if (const ASTSignal *astsig = value_cast(value)) { - _scopeChain->appendJsScope(astsig->bodyScope()); - // signals defined in C++ - } else if (const CppComponentValue *qmlObject = value_cast(owner)) { - if (const ObjectValue *scope = qmlObject->signalScope(name)) - _scopeChain->appendJsScope(scope); + if (!_scopeChain->qmlScopeObjects().isEmpty() + && name.startsWith(QLatin1String("on")) + && !script->qualifiedId->next) { + const ObjectValue *owner = 0; + const Value *value = 0; + // try to find the name on the scope objects + foreach (const ObjectValue *scope, _scopeChain->qmlScopeObjects()) { + value = scope->lookupMember(name, _scopeChain->context(), &owner); + if (value) + break; + } + // signals defined in QML + if (const ASTSignal *astsig = value_cast(value)) { + _scopeChain->appendJsScope(astsig->bodyScope()); + // signals defined in C++ + } else if (const CppComponentValue *qmlObject = value_cast(owner)) { + if (const ObjectValue *scope = qmlObject->signalScope(name)) + _scopeChain->appendJsScope(scope); + } } } } diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.cpp b/src/libs/qmljs/qmljsstaticanalysismessage.cpp index dd8c4098dd3..01a09a00b2f 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.cpp +++ b/src/libs/qmljs/qmljsstaticanalysismessage.cpp @@ -225,19 +225,19 @@ StaticAnalysisMessages::StaticAnalysisMessages() newMsg(ErrUnsupportedRootTypeInVisualDesigner, Error, tr("This type (%1) is not supported as a root element by Qt Quick Designer."), 1); newMsg(ErrUnsupportedRootTypeInQmlUi, Error, - tr("This type (%1) is not supported as a root element of a Qt Quick ui file."), 1); + tr("This type (%1) is not supported as a root element of a Qt Quick UI form."), 1); newMsg(ErrUnsupportedTypeInQmlUi, Error, - tr("This type (%1) is not supported in a Qt Quick ui file."), 1); + tr("This type (%1) is not supported in a Qt Quick UI form."), 1); newMsg(ErrFunctionsNotSupportedInQmlUi, Error, - tr("Functions are not supported in a Qt Quick ui file.")); + tr("Functions are not supported in a Qt Quick UI form.")); newMsg(ErrBlocksNotSupportedInQmlUi, Error, - tr("Java Script blocks are not supported in a Qt Quick ui file.")); + tr("Java Script blocks are not supported in a Qt Quick UI form.")); newMsg(ErrBehavioursNotSupportedInQmlUi, Error, - tr("Behaviours are not supported in a Qt Quick ui file.")); + tr("Behavior type is not supported in a Qt Quick UI form.")); newMsg(ErrStatesOnlyInRootItemInQmlUi, Error, - tr("States are only supported in the root item in a Qt Quick ui file.")); + tr("States are only supported in the root item in a Qt Quick UI form.")); newMsg(ErrReferenceToParentItemNotSupportedInQmlUi, Error, - tr("Referencing the parent of the root item is not supported in a Qt Quick ui file.")); + tr("Referencing the parent of the root item is not supported in a Qt Quick UI form.")); } } // anonymous namespace diff --git a/src/libs/qtcreatorcdbext/knowntype.h b/src/libs/qtcreatorcdbext/knowntype.h index b2da97e716a..cf7de8cf02a 100644 --- a/src/libs/qtcreatorcdbext/knowntype.h +++ b/src/libs/qtcreatorcdbext/knowntype.h @@ -143,6 +143,7 @@ enum KnownType KT_QScriptValue = KT_Qt_Type + KT_HasSimpleDumper + 91, KT_QHostAddress = KT_Qt_Type + KT_HasSimpleDumper + 92, KT_QProcess = KT_Qt_Type + KT_HasSimpleDumper + 93, + KT_QTimeZone = KT_Qt_Type + KT_HasSimpleDumper + 94, // Types: Qt primitive types KT_QFixed = KT_Qt_Type + KT_Qt_PrimitiveType + 90, KT_QTextItem = KT_Qt_Type + KT_Qt_PrimitiveType + 91, diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp index c189849c91e..2448a11edf6 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp @@ -1225,6 +1225,8 @@ static KnownType knownClassTypeHelper(const std::string &type, return KT_QMetaEnum; if (!type.compare(qPos, 9, "QTextItem")) return KT_QTextItem; + if (!type.compare(qPos, 9, "QTimeZone")) + return KT_QTimeZone; if (!type.compare(qPos, 9, "QVector2D")) return KT_QVector2D; if (!type.compare(qPos, 9, "QVector3D")) @@ -1789,12 +1791,25 @@ static bool dumpQByteArrayFromQPrivateClass(const SymbolGroupValue &v, const ULONG64 byteArrayAddress = addressOfQPrivateMember(v, mode, additionalOffset); if (!byteArrayAddress) return false; - const std::string dumpType = QtInfo::get(v.context()).prependQtCoreModule("QByteArray"); - const std::string symbolName = SymbolGroupValue::pointedToSymbolName(byteArrayAddress , dumpType); + std::string dumpType = QtInfo::get(v.context()).prependQtCoreModule("QByteArray"); + std::string symbolName = SymbolGroupValue::pointedToSymbolName(byteArrayAddress , dumpType); + if (SymbolGroupValue::verbose > 1) + DebugPrint() << "dumpQByteArrayFromQPrivateClass of " << v.name() << '/' + << v.type() << " mode=" << mode + << " offset=" << additionalOffset << " address=0x" << std::hex << byteArrayAddress + << std::dec << " expr=" << symbolName; SymbolGroupNode *byteArrayNode = v.node()->symbolGroup()->addSymbol(v.module(), symbolName, std::string(), &errorMessage); - if (!byteArrayNode) - return false; + if (!byteArrayNode && errorMessage.find("DEBUG_ANY_ID") != std::string::npos) { + // HACK: + // In some rare cases the AddSymbol can't create a node with a given module name, + // but is able to add the symbol without any modulename. + dumpType = QtInfo::get(v.context()).prependModuleAndNameSpace("QByteArray", "", QtInfo::get(v.context()).nameSpace); + symbolName = SymbolGroupValue::pointedToSymbolName(byteArrayAddress , dumpType); + byteArrayNode = v.node()->symbolGroup()->addSymbol(v.module(), symbolName, std::string(), &errorMessage); + if (!byteArrayNode) + return false; + } return dumpQByteArray(SymbolGroupValue(byteArrayNode, v.context()), str); } @@ -2134,6 +2149,11 @@ static bool dumpQDateTime(const SymbolGroupValue &v, std::wostream &str) return true; } +static bool dumpQTimeZone(const SymbolGroupValue &v, std::wostream &str) +{ + return dumpQByteArrayFromQPrivateClass(v, QPDM_qSharedDataPadded, SymbolGroupValue::pointerSize(), str); +} + static bool dumpQPixmap(const SymbolGroupValue &v, std::wostream &str) { const SymbolGroupValue pixmapSharedData = v["data"]["d"]; @@ -2754,6 +2774,9 @@ unsigned dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx, case KT_QDateTime: rc = dumpQDateTime(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed; break; + case KT_QTimeZone: + rc = dumpQTimeZone(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed; + break; case KT_QPoint: case KT_QPointF: rc = dumpQPoint_F(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed; diff --git a/src/libs/ssh/sshkeycreationdialog.cpp b/src/libs/ssh/sshkeycreationdialog.cpp index ff38fe239f7..39d36aa993c 100644 --- a/src/libs/ssh/sshkeycreationdialog.cpp +++ b/src/libs/ssh/sshkeycreationdialog.cpp @@ -142,7 +142,7 @@ void SshKeyCreationDialog::saveKeys() bool SshKeyCreationDialog::userForbidsOverwriting() { - if (!QFileInfo(privateKeyFilePath()).exists() && !QFileInfo(publicKeyFilePath()).exists()) + if (!QFileInfo::exists(privateKeyFilePath()) && !QFileInfo::exists(publicKeyFilePath())) return false; const QMessageBox::StandardButton reply = QMessageBox::question(this, tr("File Exists"), tr("There already is a file of that name. Do you want to overwrite it?"), diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h index a3659983ec4..5efaed2343b 100644 --- a/src/libs/utils/algorithm.h +++ b/src/libs/utils/algorithm.h @@ -35,6 +35,7 @@ #include #include +#include namespace Utils { @@ -140,13 +141,100 @@ auto equal(R (S::*function)() const, T value) // transform ///////////////// -// transform taking a member function pointer -template -Q_REQUIRED_RESULT -auto transform(const QList &container, R (S::*p)() const) - -> QList::type>::type> +namespace { +// needed for msvc 2010, that doesn't have a declval +// can be removed once we stop supporting it +template +T &&declval(); + +///////////////// +// helper code for transform to use back_inserter and thus push_back for everything +// and insert for QSet<> +// + +// QSetInsertIterator, straight from the standard for insert_iterator +// just without the additional parameter to insert +template + class QSetInsertIterator : + public std::iterator { - QList::type>::type> result; +protected: + Container *container; + +public: + typedef Container container_type; + explicit QSetInsertIterator (Container &x) + : container(&x) {} + QSetInsertIterator &operator=(const typename Container::value_type &value) + { container->insert(value); return *this; } + QSetInsertIterator &operator= (typename Container::value_type &&value) + { container->insert(std::move(value)); return *this; } + QSetInsertIterator&operator*() + { return *this; } + QSetInsertIterator &operator++() + { return *this; } + QSetInsertIterator operator++(int) + { return *this; } +}; + +// inserter helper function, returns a std::back_inserter for most containers +// and is overloaded for QSet<> to return a QSetInsertIterator +template +inline std::back_insert_iterator +inserter(C &container) +{ + return std::back_inserter(container); +} + +template +inline QSetInsertIterator> +inserter(QSet &container) +{ + return QSetInsertIterator>(container); +} + +// helper: removes const, volatile and references from a type +template +struct RemoveCvAndReference +{ + typedef typename std::remove_cv::type>::type type; +}; + +template +struct ResultOfFunctionWithoutCvAndReference +{ + typedef typename RemoveCvAndReference()(declval()))>::type type; +}; + +// actual implementation of transform +template class C, // result container type + template class SC, // input container type + typename T, // element type of input container + typename F> // function type +Q_REQUIRED_RESULT +auto transform_impl(const SC &container, F function) + -> C::type> +{ + C::type> result; + result.reserve(container.size()); + std::transform(container.begin(), container.end(), + inserter(result), + function); + return result; +} + +} + +// transform taking a member function pointer +template class C, + typename T, + typename R, + typename S> +Q_REQUIRED_RESULT +auto transform(const C &container, R (S::*p)() const) + -> C::type> +{ + C::type> result; result.reserve(container.size()); std::transform(container.begin(), container.end(), std::back_inserter(result), @@ -154,25 +242,53 @@ auto transform(const QList &container, R (S::*p)() const) return result; } -namespace { -// needed for msvc 2010, that doesn't have a declval -// can be removed once we stop supporting it -template -T &&declval(); +// same container type for input and output, e.g. transforming a QList into QList +template class C, // container + typename T, // element type + typename F> // function type +Q_REQUIRED_RESULT +auto transform(const C &container, F function) + -> C()(declval()))>::type> +{ + return transform_impl(container, function); } -// Note: add overloads for other container types as needed -template +// different container types for input and output, e.g. transforming a QList into a QSet +template class C, // result container type + template class SC, // input container type + typename T, // element type of input container + typename F> // function type Q_REQUIRED_RESULT -auto transform(const QList &container, F function) - -> QList()))>::type>::type> +auto transform(const SC &container, F function) + -> C()(declval()))>::type> { - QList()))>::type>::type> result; - result.reserve(container.size()); - std::transform(container.begin(), container.end(), - std::back_inserter(result), - function); - return result; + return transform_impl(container, function); +} + + +////////// +// transform for QStringList, because that isn't a specialization but a separate type +// and g++ doesn't want to use the above templates for that +// clang and msvc do find the base class QList +////////// + +// QStringList -> QList<> +template // function type +Q_REQUIRED_RESULT +auto transform(const QStringList &container, F function) + -> QList()(declval()))>::type> +{ + return transform_impl(QList(container), function); +} + +// QStringList -> any container type +template class C, // result container type + typename F> // function type +Q_REQUIRED_RESULT +auto transform(const QStringList &container, F function) + -> C()(declval()))>::type> +{ + return transform_impl(QList(container), function); } ////////////////// diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp index abcae50ca8b..a80b4aab768 100644 --- a/src/libs/utils/buildablehelperlibrary.cpp +++ b/src/libs/utils/buildablehelperlibrary.cpp @@ -65,22 +65,40 @@ QString BuildableHelperLibrary::qtChooserToQmakePath(const QString &path) return result; } +static bool isQmake(const QString &path) +{ + if (path.isEmpty()) + return false; + QFileInfo fi(path); + if (BuildableHelperLibrary::isQtChooser(fi)) + fi.setFile(BuildableHelperLibrary::qtChooserToQmakePath(fi.symLinkTarget())); + + return !BuildableHelperLibrary::qtVersionForQMake(fi.absoluteFilePath()).isEmpty(); +} + FileName BuildableHelperLibrary::findSystemQt(const Environment &env) { + const QString qmake = QLatin1String("qmake"); QStringList paths = env.path(); foreach (const QString &path, paths) { - QString prefix = path; - if (!prefix.endsWith(QLatin1Char('/'))) - prefix.append(QLatin1Char('/')); - foreach (const QString &possibleCommand, possibleQMakeCommands()) { - QFileInfo qmake(prefix + possibleCommand); - if (qmake.exists()) { - if (isQtChooser(qmake)) - qmake.setFile(qtChooserToQmakePath(qmake.symLinkTarget())); + if (path.isEmpty()) + continue; - if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull()) - return FileName(qmake); - } + QDir dir(path); + + if (dir.exists(qmake)) { + const QString qmakePath = dir.absoluteFilePath(qmake); + if (isQmake(qmakePath)) + return FileName::fromString(qmakePath); + } + + // Prefer qmake-qt5 to qmake-qt4 by sorting the filenames in reverse order. + foreach (const QFileInfo &fi, dir.entryInfoList(possibleQMakeCommands(), QDir::Files, QDir::Name | QDir::Reversed)) { + if (fi.fileName() == qmake) + continue; + + if (isQmake(fi.absoluteFilePath())) + return FileName(fi); } } return FileName(); @@ -88,20 +106,12 @@ FileName BuildableHelperLibrary::findSystemQt(const Environment &env) QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath) { - bool qmakeIsExecutable; - return BuildableHelperLibrary::qtVersionForQMake(qmakePath, &qmakeIsExecutable); -} - -QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath, bool *qmakeIsExecutable) -{ - *qmakeIsExecutable = !qmakePath.isEmpty(); - if (!*qmakeIsExecutable) + if (qmakePath.isEmpty()) return QString(); QProcess qmake; qmake.start(qmakePath, QStringList(QLatin1String("--version"))); if (!qmake.waitForStarted()) { - *qmakeIsExecutable = false; qWarning("Cannot start '%s': %s", qPrintable(qmakePath), qPrintable(qmake.errorString())); return QString(); } @@ -111,7 +121,6 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath, bool return QString(); } if (qmake.exitStatus() != QProcess::NormalExit) { - *qmakeIsExecutable = false; qWarning("'%s' crashed.", qPrintable(qmakePath)); return QString(); } @@ -260,7 +269,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments, log->append(newline); const FileName makeFullPath = arguments.environment.searchInPath(arguments.makeCommand); - if (QFileInfo(arguments.directory + QLatin1String("/Makefile")).exists()) { + if (QFileInfo::exists(arguments.directory + QLatin1String("/Makefile"))) { if (makeFullPath.isEmpty()) { *errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", "%1 not found in PATH\n").arg(arguments.makeCommand); diff --git a/src/libs/utils/buildablehelperlibrary.h b/src/libs/utils/buildablehelperlibrary.h index 0631797102e..83d37b2e124 100644 --- a/src/libs/utils/buildablehelperlibrary.h +++ b/src/libs/utils/buildablehelperlibrary.h @@ -46,9 +46,8 @@ public: static FileName findSystemQt(const Environment &env); static bool isQtChooser(const QFileInfo &info); static QString qtChooserToQmakePath(const QString &path); - // return true if the qmake at qmakePath is qt4 (used by QtVersion) + // return true if the qmake at qmakePath is a Qt (used by QtVersion) static QString qtVersionForQMake(const QString &qmakePath); - static QString qtVersionForQMake(const QString &qmakePath, bool *qmakeIsExecutable); // returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion) static QStringList possibleQMakeCommands(); diff --git a/src/libs/utils/codegeneration.cpp b/src/libs/utils/codegeneration.cpp index 7b9e07795f7..94caf4abb68 100644 --- a/src/libs/utils/codegeneration.cpp +++ b/src/libs/utils/codegeneration.cpp @@ -110,25 +110,39 @@ void writeQtIncludeSection(const QStringList &qt4, else trans = [](const QString &i) { return i.mid(i.indexOf(QLatin1Char('/')) + 1); }; - QSet qt4Only = QSet::fromList(Utils::transform(qt4, trans)); - QSet qt5Only = QSet::fromList(Utils::transform(qt5, trans)); - QSet common = qt4Only; + QSet qt4Only = Utils::transform(qt4, trans); + QSet qt5Only = Utils::transform(qt5, trans); - common.intersect(qt5Only); - qt4Only.subtract(common); - qt5Only.subtract(common); + if (addQtVersionCheck) { + QSet common = qt4Only; + common.intersect(qt5Only); - qtSection(common.toList(), str); + // qglobal.h is needed for QT_VERSION + if (includeQtModule) + common.insert(QLatin1String("QtCore/qglobal.h")); + else + common.insert(QLatin1String("qglobal.h")); - if (!qt4Only.isEmpty() || !qt5Only.isEmpty()) { - if (addQtVersionCheck) - writeBeginQtVersionCheck(str); - qtSection(qt5Only.toList(), str); - if (addQtVersionCheck) - str << QLatin1String("#else\n"); - qtSection(qt4Only.toList(), str); - if (addQtVersionCheck) - str << QLatin1String("#endif\n"); + qt4Only.subtract(common); + qt5Only.subtract(common); + + qtSection(common.toList(), str); + + if (!qt4Only.isEmpty() || !qt5Only.isEmpty()) { + if (addQtVersionCheck) + writeBeginQtVersionCheck(str); + qtSection(qt5Only.toList(), str); + if (addQtVersionCheck) + str << QLatin1String("#else\n"); + qtSection(qt4Only.toList(), str); + if (addQtVersionCheck) + str << QLatin1String("#endif\n"); + } + } else { + if (!qt5Only.isEmpty()) // default to Qt5 + qtSection(qt5Only.toList(), str); + else + qtSection(qt4Only.toList(), str); } } diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp index 4914cb09590..7711353c04b 100644 --- a/src/libs/utils/fancymainwindow.cpp +++ b/src/libs/utils/fancymainwindow.cpp @@ -324,8 +324,7 @@ void DockWidget::handleMouseTimeout() void DockWidget::handleToplevelChanged(bool floating) { - if (!floating) - m_titleBar->setActive(false); + m_titleBar->setActive(floating); } diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index d06f8542fc5..c911a98860d 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -144,7 +144,7 @@ bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgt { QFileInfo srcFileInfo = srcFilePath.toFileInfo(); if (srcFileInfo.isDir()) { - if (!tgtFilePath.toFileInfo().exists()) { + if (!tgtFilePath.exists()) { QDir targetDir(tgtFilePath.toString()); targetDir.cdUp(); if (!targetDir.mkdir(tgtFilePath.toFileInfo().fileName())) { @@ -551,6 +551,13 @@ QString FileName::toUserOutput() const return QDir::toNativeSeparators(toString()); } +/// \returns a bool indicating whether a file with this +/// FileName exists. +bool FileName::exists() const +{ + return QFileInfo::exists(*this); +} + /// Find the parent directory of a given directory. /// Returns an empty FileName if the current directory is already diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index 6240700c24c..4e2403322ba 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -72,6 +72,7 @@ public: static FileName fromUserInput(const QString &filename); QString toString() const; QString toUserOutput() const; + bool exists() const; FileName parentDir() const; diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp index 8b65275b2df..3bef7cc433a 100644 --- a/src/libs/utils/macroexpander.cpp +++ b/src/libs/utils/macroexpander.cpp @@ -29,9 +29,11 @@ ****************************************************************************/ #include "macroexpander.h" -#include "qtcprocess.h" #include "algorithm.h" +#include "qtcassert.h" +#include "qtcprocess.h" +#include "stringutils.h" #include #include @@ -49,7 +51,9 @@ const char kFileBaseNamePostfix[] = ":FileBaseName"; class MacroExpanderPrivate : public AbstractMacroExpander { public: - MacroExpanderPrivate() : m_accumulating(false) {} + MacroExpanderPrivate() + : m_accumulating(false), m_aborted(false), m_lockDepth(0) + {} bool resolveMacro(const QString &name, QString *ret) { @@ -101,12 +105,16 @@ public: QHash m_map; QHash m_prefixMap; + QSet m_invisbleInChooser; QVector m_extraResolvers; QMap m_descriptions; QString m_displayName; QVector m_subProviders; QVector m_subExpanders; // Not owned bool m_accumulating; + + bool m_aborted; + int m_lockDepth; }; } // Internal @@ -260,8 +268,24 @@ QString MacroExpander::value(const QByteArray &variable, bool *found) const */ QString MacroExpander::expand(const QString &stringWithVariables) const { + if (d->m_lockDepth == 0) + d->m_aborted = false; + + if (d->m_lockDepth > 3) { // Limit recursion. + d->m_aborted = true; + return QString(); + } + + ++d->m_lockDepth; + QString res = stringWithVariables; Utils::expandMacros(&res, d); + + --d->m_lockDepth; + + if (d->m_lockDepth == 0 && d->m_aborted) + return tr("Infinite recursion error") + QLatin1String(": ") + stringWithVariables; + return res; } @@ -301,8 +325,10 @@ void MacroExpander::registerPrefix(const QByteArray &prefix, const QString &desc * \sa registerFileVariables(), registerIntVariable(), registerPrefix() */ void MacroExpander::registerVariable(const QByteArray &variable, - const QString &description, const StringFunction &value) + const QString &description, const StringFunction &value, bool visibleInChooser) { + if (!visibleInChooser) + d->m_invisbleInChooser.insert(variable); d->m_descriptions.insert(variable, description); d->m_map.insert(variable, value); } @@ -335,19 +361,19 @@ void MacroExpander::registerFileVariables(const QByteArray &prefix, const QString &heading, const StringFunction &base) { registerVariable(prefix + kFilePathPostfix, - QCoreApplication::translate("Utils::MacroExpander", "%1: Full path including file name.").arg(heading), + tr("%1: Full path including file name.").arg(heading), [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).filePath(); }); registerVariable(prefix + kPathPostfix, - QCoreApplication::translate("Utils::MacroExpander", "%1: Full path excluding file name.").arg(heading), + tr("%1: Full path excluding file name.").arg(heading), [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).path(); }); registerVariable(prefix + kFileNamePostfix, - QCoreApplication::translate("Utils::MacroExpander", "%1: File name without path.").arg(heading), + tr("%1: File name without path.").arg(heading), [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).fileName(); }); registerVariable(prefix + kFileBaseNamePostfix, - QCoreApplication::translate("Utils::MacroExpander", "%1: File base name without path and suffix.").arg(heading), + tr("%1: File base name without path and suffix.").arg(heading), [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).baseName(); }); } @@ -362,9 +388,15 @@ void MacroExpander::registerExtraResolver(const MacroExpander::ResolverFunction * \sa registerVariable() * \sa registerFileVariables() */ -QList MacroExpander::variables() const +QList MacroExpander::visibleVariables() const { - return d->m_descriptions.keys(); + QList res; + for (auto it = d->m_descriptions.begin(), end = d->m_descriptions.end(); it != end; ++it) { + if (!d->m_invisbleInChooser.contains(it.key())) + res.append(it.key()); + } + + return res; } /*! @@ -386,11 +418,6 @@ MacroExpanders MacroExpander::subExpanders() const return expanders; } -AbstractMacroExpander *MacroExpander::abstractExpander() const -{ - return d; -} - QString MacroExpander::displayName() const { return d->m_displayName; @@ -418,12 +445,10 @@ void MacroExpander::setAccumulating(bool on) class GlobalMacroExpander : public MacroExpander { - Q_DECLARE_TR_FUNCTIONS(Utils::MacroExpander) - public: GlobalMacroExpander() { - setDisplayName(tr("Global variables")); + setDisplayName(MacroExpander::tr("Global variables")); registerPrefix("Env", tr("Access environment variables."), [](const QString &value) { return QString::fromLocal8Bit(qgetenv(value.toLocal8Bit())); }); } diff --git a/src/libs/utils/macroexpander.h b/src/libs/utils/macroexpander.h index 6c6007f4ffb..ae30527212a 100644 --- a/src/libs/utils/macroexpander.h +++ b/src/libs/utils/macroexpander.h @@ -31,7 +31,7 @@ #ifndef UTILS_MACROEXPANDER_H #define UTILS_MACROEXPANDER_H -#include "stringutils.h" +#include "utils_global.h" #include @@ -49,15 +49,16 @@ typedef QVector MacroExpanders; class QTCREATOR_UTILS_EXPORT MacroExpander { - Q_DECLARE_TR_FUNCTIONS("MacroExpander") + Q_DECLARE_TR_FUNCTIONS(Utils::MacroExpander) + Q_DISABLE_COPY(MacroExpander) public: explicit MacroExpander(); - virtual ~MacroExpander(); + ~MacroExpander(); - virtual bool resolveMacro(const QString &name, QString *ret) const; + bool resolveMacro(const QString &name, QString *ret) const; - virtual QString value(const QByteArray &variable, bool *found = 0) const; + QString value(const QByteArray &variable, bool *found = 0) const; QString expand(const QString &stringWithVariables) const; QByteArray expand(const QByteArray &stringWithVariables) const; @@ -73,7 +74,8 @@ public: const QString &description, const PrefixFunction &value); void registerVariable(const QByteArray &variable, - const QString &description, const StringFunction &value); + const QString &description, const StringFunction &value, + bool visibleInChooser = true); void registerIntVariable(const QByteArray &variable, const QString &description, const IntFunction &value); @@ -83,11 +85,10 @@ public: void registerExtraResolver(const ResolverFunction &value); - QList variables() const; + QList visibleVariables() const; QString variableDescription(const QByteArray &variable) const; MacroExpanders subExpanders() const; - AbstractMacroExpander *abstractExpander() const; QString displayName() const; void setDisplayName(const QString &displayName); @@ -98,9 +99,6 @@ public: void setAccumulating(bool on); private: - MacroExpander(const MacroExpander &) Q_DECL_EQ_DELETE; - void operator=(const MacroExpander &) Q_DECL_EQ_DELETE; - friend class Internal::MacroExpanderPrivate; Internal::MacroExpanderPrivate *d; }; diff --git a/src/libs/utils/theme/theme.cpp b/src/libs/utils/theme/theme.cpp index 09f699ff217..95b03c9c86f 100644 --- a/src/libs/utils/theme/theme.cpp +++ b/src/libs/utils/theme/theme.cpp @@ -30,6 +30,7 @@ #include "theme.h" #include "theme_p.h" +#include "../algorithm.h" #include "../qtcassert.h" #include @@ -80,6 +81,11 @@ Theme::WidgetStyle Theme::widgetStyle() const return d->widgetStyle; } +QStringList Theme::preferredStyles() const +{ + return d->preferredStyles; +} + bool Theme::flag(Theme::Flag f) const { return d->flags[f]; @@ -171,6 +177,7 @@ void Theme::writeSettings(const QString &filename) const const QMetaObject &m = *metaObject(); { settings.setValue(QLatin1String("ThemeName"), d->name); + settings.setValue(QLatin1String("PreferredStyles"), d->preferredStyles); } { settings.beginGroup(QLatin1String("Palette")); @@ -249,6 +256,7 @@ void Theme::readSettings(QSettings &settings) { d->name = settings.value(QLatin1String("ThemeName"), QLatin1String("unnamed")).toString(); + d->preferredStyles = settings.value(QLatin1String("PreferredStyles")).toStringList(); } { settings.beginGroup(QLatin1String("Palette")); diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index d9b41c15ca2..a8d5bfcbc3a 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -184,7 +184,8 @@ public: DrawProgressBarSunken, DrawIndicatorBranch, ComboBoxDrawTextShadow, - DerivePaletteFromTheme + DerivePaletteFromTheme, + ApplyThemePaletteGlobally }; enum WidgetStyle { @@ -198,6 +199,7 @@ public: QString imageFile(ImageFile imageFile, const QString &fallBack) const; QGradientStops gradient(Gradient role) const; QPalette palette(const QPalette &base) const; + QStringList preferredStyles() const; QString fileName() const; void setName(const QString &name); diff --git a/src/libs/utils/theme/theme_p.h b/src/libs/utils/theme/theme_p.h index e1493a17e33..bf78904e7ed 100644 --- a/src/libs/utils/theme/theme_p.h +++ b/src/libs/utils/theme/theme_p.h @@ -46,6 +46,7 @@ public: QString fileName; QString name; + QStringList preferredStyles; QVector > colors; QVector imageFiles; QVector gradients; diff --git a/src/libs/utils/treeviewcombobox.cpp b/src/libs/utils/treeviewcombobox.cpp index 4d286ba1102..e70d1801afa 100644 --- a/src/libs/utils/treeviewcombobox.cpp +++ b/src/libs/utils/treeviewcombobox.cpp @@ -111,12 +111,12 @@ void TreeViewComboBox::keyPressEvent(QKeyEvent *e) setCurrentIndex(indexBelow(m_view->currentIndex())); } else if (e->key() == Qt::Key_Home) { QModelIndex index = m_view->model()->index(0, 0); - if (index.isValid() && !model()->flags(index) & Qt::ItemIsSelectable) + if (index.isValid() && !(model()->flags(index) & Qt::ItemIsSelectable)) index = indexBelow(index); setCurrentIndex(index); } else if (e->key() == Qt::Key_End) { QModelIndex index = lastIndex(m_view->rootIndex()); - if (index.isValid() && !model()->flags(index) & Qt::ItemIsSelectable) + if (index.isValid() && !(model()->flags(index) & Qt::ItemIsSelectable)) index = indexAbove(index); setCurrentIndex(index); } else { diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 895c745f2b0..508f943e8e3 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -384,7 +384,7 @@ FileName AndroidConfig::androidToolPath() const // Java and I've made some progress on it. So if android.exe exists, return that instead. FileName path = m_sdkLocation; path.appendPath(QLatin1String("tools/android" QTC_HOST_EXE_SUFFIX)); - if (path.toFileInfo().exists()) + if (path.exists()) return path; path = m_sdkLocation; return path.appendPath(QLatin1String("tools/android" ANDROID_BAT_SUFFIX)); @@ -1213,7 +1213,7 @@ static FileName javaHomeForJavac(const FileName &location) while (tries > 0) { QDir dir = fileInfo.dir(); dir.cdUp(); - if (QFileInfo(dir.filePath(QLatin1String("lib/tools.jar"))).exists()) + if (QFileInfo::exists(dir.filePath(QLatin1String("lib/tools.jar")))) return FileName::fromString(dir.path()); if (fileInfo.isSymLink()) fileInfo.setFile(fileInfo.symLinkTarget()); @@ -1252,7 +1252,7 @@ void AndroidConfigurations::load() } } else if (HostOsInfo::isMacHost()) { QString javaHome = QLatin1String("/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"); - if (QFileInfo(javaHome).exists()) + if (QFileInfo::exists(javaHome)) m_config.setOpenJDKLocation(Utils::FileName::fromString(javaHome)); } else if (HostOsInfo::isWindowsHost()) { QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Javasoft\\Java Development Kit"), QSettings::NativeFormat); @@ -1275,7 +1275,7 @@ void AndroidConfigurations::load() settings.beginGroup(version); QString tmpJavaHome = settings.value(QLatin1String("JavaHome")).toString(); settings.endGroup(); - if (!QFileInfo(tmpJavaHome).exists()) + if (!QFileInfo::exists(tmpJavaHome)) continue; major = tmpMajor; @@ -1299,7 +1299,7 @@ void AndroidConfigurations::load() void AndroidConfigurations::updateAndroidDevice() { DeviceManager * const devMgr = DeviceManager::instance(); - if (m_instance->m_config.adbToolPath().toFileInfo().exists()) + if (m_instance->m_config.adbToolPath().exists()) devMgr->addDevice(IDevice::Ptr(new Internal::AndroidDevice)); else if (devMgr->find(Constants::ANDROID_DEVICE_ID)) devMgr->removeDevice(Core::Id(Constants::ANDROID_DEVICE_ID)); diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp index 1c88ab18ef3..e5177749f32 100644 --- a/src/plugins/android/androiddebugsupport.cpp +++ b/src/plugins/android/androiddebugsupport.cpp @@ -166,7 +166,7 @@ AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig, [this](const QString &errorMsg) { QTC_ASSERT(m_runControl, return); m_runControl->appendMessage(errorMsg, Utils::DebugFormat); - m_engine->notifyInferiorExited(); + QMetaObject::invokeMethod(m_engine, "notifyInferiorExited", Qt::QueuedConnection); }); connect(m_runner, &AndroidRunner::remoteErrorOutput, diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 84f1b612f58..c0ecde44843 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -587,7 +587,7 @@ bool AndroidManager::checkCertificatePassword(const QString &keystorePath, const bool AndroidManager::checkForQt51Files(Utils::FileName fileName) { fileName.appendPath(QLatin1String("android")).appendPath(QLatin1String("version.xml")); - if (!fileName.toFileInfo().exists()) + if (!fileName.exists()) return false; QDomDocument dstVersionDoc; if (!openXmlFile(dstVersionDoc, fileName)) @@ -684,7 +684,7 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target) AndroidBuildApkStep *buildApkStep = AndroidGlobal::buildStep(target->activeBuildConfiguration()); - if (!buildApkStep || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).toFileInfo().exists()) + if (!buildApkStep || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).exists()) return false; GradleProperties localProperties; diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp index bb60e33ad05..f02ae1d413b 100644 --- a/src/plugins/android/androidmanifesteditorwidget.cpp +++ b/src/plugins/android/androidmanifesteditorwidget.cpp @@ -1259,7 +1259,7 @@ QIcon AndroidManifestEditorWidget::icon(const QString &baseDir, IconDPI dpi) void AndroidManifestEditorWidget::copyIcon(IconDPI dpi, const QString &baseDir, const QString &filePath) { - if (!QFileInfo(filePath).exists()) + if (!QFileInfo::exists(filePath)) return; const QString targetPath = iconPath(baseDir, dpi); diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 54eba1ca906..c741286f1d8 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -256,9 +256,9 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode) m_ui->gdbWarningLabel->setVisible(false); if (m_androidConfig.ndkLocation().isEmpty()) { m_ndkState = NotSet; - } else if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists() - || !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists() - || !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) { + } else if (!platformPath.appendPath(QLatin1String("platforms")).exists() + || !toolChainPath.appendPath(QLatin1String("toolchains")).exists() + || !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).exists()) { m_ndkState = Error; m_ndkErrorMessage = tr("\"%1\" does not seem to be an Android NDK top folder.") .arg(m_androidConfig.ndkLocation().toUserOutput()); @@ -277,7 +277,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode) if (ati.architecture != ProjectExplorer::Abi::ArmArchitecture) continue; Utils::FileName gdbPath = m_androidConfig.gdbPath(ati.architecture, ati.version); - if (gdbPath.toFileInfo().exists()) + if (gdbPath.exists()) gdbPaths << gdbPath.toString(); } @@ -325,8 +325,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode) } else { Utils::FileName bin = m_androidConfig.openJDKLocation(); bin.appendPath(QLatin1String("bin/javac" QTC_HOST_EXE_SUFFIX)); - if (!m_androidConfig.openJDKLocation().toFileInfo().exists() - || !bin.toFileInfo().exists()) + if (!m_androidConfig.openJDKLocation().exists() || !bin.exists()) m_javaState = Error; } } @@ -407,15 +406,15 @@ bool AndroidSettingsWidget::sdkLocationIsValid() const Utils::FileName androidExe = m_androidConfig.sdkLocation(); Utils::FileName androidBat = m_androidConfig.sdkLocation(); Utils::FileName emulator = m_androidConfig.sdkLocation(); - return (androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists() - || androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists()) - && emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists(); + return (androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).exists() + || androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).exists()) + && emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).exists(); } bool AndroidSettingsWidget::sdkPlatformToolsInstalled() const { Utils::FileName adb = m_androidConfig.sdkLocation(); - return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists(); + return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).exists(); } void AndroidSettingsWidget::saveSettings() @@ -477,7 +476,7 @@ void AndroidSettingsWidget::searchForAnt(const Utils::FileName &location) ant.appendPath(QLatin1String("ant.bat")); else ant.appendPath(QLatin1String("ant")); - if (ant.toFileInfo().exists()) { + if (ant.exists()) { m_androidConfig.setAntLocation(ant); m_ui->AntLocationPathChooser->setFileName(ant); } diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp index ff1841e0480..b2176437a70 100644 --- a/src/plugins/android/androidtoolchain.cpp +++ b/src/plugins/android/androidtoolchain.cpp @@ -122,7 +122,7 @@ void AndroidToolChain::addToEnvironment(Environment &env) const env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfig::toolsPrefix(targetAbi().architecture())); env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), m_ndkToolChainVersion); QString javaHome = AndroidConfigurations::currentConfig().openJDKLocation().toString(); - if (!javaHome.isEmpty() && QFileInfo(javaHome).exists()) + if (!javaHome.isEmpty() && QFileInfo::exists(javaHome)) env.set(QLatin1String("JAVA_HOME"), javaHome); env.set(QLatin1String("ANDROID_HOME"), AndroidConfigurations::currentConfig().sdkLocation().toString()); env.set(QLatin1String("ANDROID_SDK_ROOT"), AndroidConfigurations::currentConfig().sdkLocation().toString()); @@ -151,13 +151,13 @@ FileName AndroidToolChain::suggestedGdbServer() const Utils::FileName path = AndroidConfigurations::currentConfig().ndkLocation(); path.appendPath(QString::fromLatin1("prebuilt/android-%1/gdbserver/gdbserver") .arg(Abi::toString(targetAbi().architecture()))); - if (path.toFileInfo().exists()) + if (path.exists()) return path; path = AndroidConfigurations::currentConfig().ndkLocation(); path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver") .arg(AndroidConfig::toolchainPrefix(targetAbi().architecture())) .arg(m_ndkToolChainVersion)); - if (path.toFileInfo().exists()) + if (path.exists()) return path; return Utils::FileName(); diff --git a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp index 63edb321013..2f92f930215 100644 --- a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp @@ -173,9 +173,8 @@ void AutoreconfStep::run(QFutureInterface &interface) // Check whether we need to run autoreconf const QString projectDir(bc->target()->project()->projectDirectory().toString()); - const QFileInfo configureInfo(projectDir + QLatin1String("/configure")); - if (!configureInfo.exists()) + if (!QFileInfo::exists(projectDir + QLatin1String("/configure"))) m_runAutoreconf = true; if (!m_runAutoreconf) { diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 0d109918393..63843f76ea4 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -247,6 +247,12 @@ public: return true; } + ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const + { + Q_UNUSED(state) + return type == TypeRemoved ? BehaviorSilent : BehaviorAsk; + } + bool save(QString *errorString, const QString &fn, bool autoSave) { QTC_ASSERT(!autoSave, return true); // bineditor does not support autosave - it would be a bit expensive @@ -363,8 +369,7 @@ public: BinEditor(BinEditorWidget *widget) { setWidget(widget); - m_widget = widget; - m_file = new BinEditorDocument(m_widget); + m_file = new BinEditorDocument(widget); m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); m_context.add(Constants::C_BINEDITOR); m_addressEdit = new QLineEdit; @@ -387,13 +392,14 @@ public: widget->setEditor(this); - connect(m_widget, SIGNAL(cursorPositionChanged(int)), SLOT(updateCursorPosition(int))); + connect(widget, SIGNAL(cursorPositionChanged(int)), SLOT(updateCursorPosition(int))); connect(m_addressEdit, SIGNAL(editingFinished()), SLOT(jumpToAddress())); - connect(m_widget, SIGNAL(modificationChanged(bool)), m_file, SIGNAL(changed())); - updateCursorPosition(m_widget->cursorPosition()); + connect(widget, SIGNAL(modificationChanged(bool)), m_file, SIGNAL(changed())); + updateCursorPosition(widget->cursorPosition()); } - ~BinEditor() { + ~BinEditor() + { delete m_widget; } @@ -407,16 +413,22 @@ public: private slots: void updateCursorPosition(int position) { - m_addressEdit->setText(QString::number(m_widget->baseAddress() + position, 16)); + m_addressEdit->setText(QString::number(editorWidget()->baseAddress() + position, 16)); } void jumpToAddress() { - m_widget->jumpToAddress(m_addressEdit->text().toULongLong(0, 16)); - updateCursorPosition(m_widget->cursorPosition()); + editorWidget()->jumpToAddress(m_addressEdit->text().toULongLong(0, 16)); + updateCursorPosition(editorWidget()->cursorPosition()); + } + +private: + inline BinEditorWidget *editorWidget() const + { + QTC_ASSERT(qobject_cast(m_widget.data()), return 0); + return static_cast(m_widget.data()); } private: - BinEditorWidget *m_widget; BinEditorDocument *m_file; QToolBar *m_toolBar; QLineEdit *m_addressEdit; diff --git a/src/plugins/clangcodemodel/clangcompletion.cpp b/src/plugins/clangcodemodel/clangcompletion.cpp index 4edc0154486..d6019fb6876 100644 --- a/src/plugins/clangcodemodel/clangcompletion.cpp +++ b/src/plugins/clangcodemodel/clangcompletion.cpp @@ -61,11 +61,10 @@ #include #include +#include #include #include -static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1"; - using namespace ClangCodeModel; using namespace ClangCodeModel::Internal; using namespace CPlusPlus; @@ -73,6 +72,7 @@ using namespace CppTools; using namespace TextEditor; static const char SNIPPET_ICON_PATH[] = ":/texteditor/images/snippet.png"; +static Q_LOGGING_CATEGORY(log, "qtc.clangcodemodel.completion") namespace { @@ -170,17 +170,13 @@ static QList unfilteredCompletion(const ClangCompletionAss if (!modifiedInput.isEmpty()) unsavedFiles.insert(fileName, modifiedInput); - QTime t; - if (DebugTiming) { - qDebug() << "Here we go with ClangCompletionAssistProcessor...."; - t.start(); - } + qCDebug(log) << "Starting completion..."; + QTime t; t.start(); QList result = wrapper->codeCompleteAt(line, column + 1, unsavedFiles); ::Utils::sort(result); - if (DebugTiming) - qDebug() << "... Completion done in" << t.elapsed() << "ms, with" << result.count() << "items."; + qCDebug(log) << "Completion done in" << t.elapsed() << "ms, with" << result.count() << "items."; return result; } @@ -977,8 +973,7 @@ int ClangCompletionAssistProcessor::startCompletionInternal(const QString fileNa int l = line, c = column; Convenience::convertPosition(m_interface->textDocument(), nameStart, &l, &c); - if (DebugTiming) - qDebug()<<"complete constructor or function @" << line<<":"<"<"< completions = unfilteredCompletion( m_interface.data(), fileName, l, c, QByteArray(), signalCompletion || slotCompletion); diff --git a/src/plugins/clangcodemodel/clangeditordocumentparser.cpp b/src/plugins/clangcodemodel/clangeditordocumentparser.cpp index 0d552bfb92c..34563506c92 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentparser.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentparser.cpp @@ -40,7 +40,9 @@ #include #include -static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1"; +#include + +static Q_LOGGING_CATEGORY(log, "qtc.clangcodemodel.clangeditordocumentparser") namespace { @@ -91,20 +93,16 @@ void ClangEditorDocumentParser::update(CppTools::WorkingCopy workingCopy) updateProjectPart(); const QStringList options = createOptions(filePath(), projectPart()); - QTime t; - if (DebugTiming) { - qDebug("*** Reparse options (cmd line equivalent): %s", - commandLine(options, filePath()).toUtf8().constData()); - t.start(); - } + qCDebug(log, "Reparse options (cmd line equivalent): %s", + commandLine(options, filePath()).toUtf8().constData()); + QTime t; t.start(); m_marker->setFileName(filePath()); m_marker->setCompilationOptions(options); const Internal::UnsavedFiles unsavedFiles = Utils::createUnsavedFiles(workingCopy); m_marker->reparse(unsavedFiles); - if (DebugTiming) - qDebug() << "*** Reparse took" << t.elapsed() << "ms."; + qCDebug(log) << "Reparse took" << t.elapsed() << "ms."; } QList ClangEditorDocumentParser::diagnostics() const diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp index bdd09ce49b3..7c7823a3d82 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp @@ -42,7 +42,9 @@ #include #include -static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1"; +#include + +static Q_LOGGING_CATEGORY(log, "qtc.clangcodemodel.clangeditordocumentprocessor") namespace { @@ -55,8 +57,7 @@ QList toCppToolsDiagnostics( QList converted; foreach (const ClangCodeModel::Diagnostic &d, diagnostics) { - if (DebugTiming) - qDebug() << d.severityAsString() << d.location() << d.spelling(); + qCDebug(log) << "diagnostic" << d.severityAsString() << d.location() << d.spelling(); if (d.location().fileName() != filePath) continue; diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp index 6fc08e38b5d..f5d3daaa31a 100644 --- a/src/plugins/clangcodemodel/clangutils.cpp +++ b/src/plugins/clangcodemodel/clangutils.cpp @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -49,11 +50,11 @@ using namespace ClangCodeModel::Internal; using namespace Core; using namespace CppTools; -static const bool BeVerbose = qgetenv("QTC_CLANG_VERBOSE") == "1"; - namespace ClangCodeModel { namespace Utils { +Q_LOGGING_CATEGORY(verboseRunLog, "qtc.clangcodemodel.verboserun") + namespace { bool isBlacklisted(const QString &path) { @@ -139,7 +140,7 @@ QStringList createClangOptions(const ProjectPart::Ptr &pPart, ProjectFile::Kind if (pPart.isNull()) return result; - if (BeVerbose) + if (verboseRunLog().isDebugEnabled()) result << QLatin1String("-v"); const bool objcExt = pPart->languageExtensions & ProjectPart::ObjectiveCExtensions; diff --git a/src/plugins/clangcodemodel/clangutils.h b/src/plugins/clangcodemodel/clangutils.h index 0dc75dca0df..66dfa1a07d5 100644 --- a/src/plugins/clangcodemodel/clangutils.h +++ b/src/plugins/clangcodemodel/clangutils.h @@ -36,9 +36,13 @@ #include +#include + namespace ClangCodeModel { namespace Utils { +Q_DECLARE_LOGGING_CATEGORY(verboseRunLog) + ClangCodeModel::Internal::UnsavedFiles createUnsavedFiles(CppTools::WorkingCopy workingCopy); QStringList createClangOptions(const CppTools::ProjectPart::Ptr &pPart, diff --git a/src/plugins/clangcodemodel/cppcreatemarkers.cpp b/src/plugins/clangcodemodel/cppcreatemarkers.cpp index 6a1519b7b3e..84bdbb12fb3 100644 --- a/src/plugins/clangcodemodel/cppcreatemarkers.cpp +++ b/src/plugins/clangcodemodel/cppcreatemarkers.cpp @@ -35,17 +35,18 @@ #include #include +#include #include #include #include -static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1"; - using namespace ClangCodeModel; using namespace ClangCodeModel::Internal; using namespace CppTools; +static Q_LOGGING_CATEGORY(log, "qtc.clangcodemodel.createmarkers") + CreateMarkers *CreateMarkers::create(SemanticMarker::Ptr semanticMarker, const QString &fileName, unsigned firstLine, unsigned lastLine) @@ -79,11 +80,9 @@ void CreateMarkers::run() if (isCanceled()) return; - QTime t; - if (DebugTiming) { - qDebug() << "*** Highlighting from" << m_firstLine << "to" << m_lastLine << "of" << m_fileName; - t.start(); - } + qCDebug(log) << "Creating markers from" << m_firstLine << "to" << m_lastLine + << "of" << m_fileName; + QTime t; t.start(); m_usages.clear(); @@ -105,10 +104,7 @@ void CreateMarkers::run() flush(); reportFinished(); - if (DebugTiming) { - qDebug() << "*** Highlighting took" << t.elapsed() << "ms in total."; - t.restart(); - } + qCDebug(log) << "Creating markers took" << t.elapsed() << "ms in total."; } void CreateMarkers::addUse(const SourceMarker &marker) diff --git a/src/plugins/clangcodemodel/unit.cpp b/src/plugins/clangcodemodel/unit.cpp index 04efe2fe903..39103dd1441 100644 --- a/src/plugins/clangcodemodel/unit.cpp +++ b/src/plugins/clangcodemodel/unit.cpp @@ -29,6 +29,8 @@ ****************************************************************************/ #include "unit.h" + +#include "clangutils.h" #include "unsavedfiledata.h" #include "utils_p.h" @@ -47,8 +49,6 @@ static QBasicAtomicInt unitDataCount = Q_BASIC_ATOMIC_INITIALIZER(0); using namespace ClangCodeModel; using namespace ClangCodeModel::Internal; -static const int DisplayDiagnostics = (qgetenv("QTC_CLANG_VERBOSE") == "1") ? 1 : 0; - Unit::Unit() : m_index(0) , m_tu(0) @@ -56,7 +56,7 @@ Unit::Unit() {} Unit::Unit(const QString &fileName) - : m_index(clang_createIndex(/*excludeDeclsFromPCH*/ 1, DisplayDiagnostics)) + : m_index(clang_createIndex(/*excludeDeclsFromPCH*/ 1, Utils::verboseRunLog().isDebugEnabled())) , m_tu(0) , m_fileName(fileName.toUtf8()) , m_managementOptions(0) diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index 7e8450cc857..873c5b5debe 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -219,7 +219,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor, if (fi.isDir()) { QDir subDir(fi.absoluteFilePath()); QString subProject = subDir.filePath(QLatin1String("CMakeLists.txt")); - if (QFileInfo(subProject).exists()) + if (QFileInfo::exists(subProject)) fileName = subProject; else return link; diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index 29b1e679672..9af767c10c4 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -147,10 +147,7 @@ CMakeManager *CMakeOpenProjectWizard::cmakeManager() const bool CMakeOpenProjectWizard::hasInSourceBuild() const { - QFileInfo fi(m_sourceDirectory + QLatin1String("/CMakeCache.txt")); - if (fi.exists()) - return true; - return false; + return QFileInfo::exists(m_sourceDirectory + QLatin1String("/CMakeCache.txt")); } bool CMakeOpenProjectWizard::compatibleKitExist() const diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index f260b6a24c0..d19792f49f0 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -586,7 +586,7 @@ QString CMakeProject::uiHeaderFile(const QString &uiFile) while (baseDirectory.isChildOf(project)) { Utils::FileName cmakeListsTxt = baseDirectory; cmakeListsTxt.appendPath(QLatin1String("CMakeLists.txt")); - if (cmakeListsTxt.toFileInfo().exists()) + if (cmakeListsTxt.exists()) break; QDir dir(baseDirectory.toString()); dir.cdUp(); @@ -875,12 +875,16 @@ void CMakeCbpParser::sortFiles() } else { int bestLength = -1; int bestIndex = -1; + int bestIncludeCount = -1; for (int i = 0; i < m_buildTargets.size(); ++i) { const CMakeBuildTarget &target = m_buildTargets.at(i); - if (fileName.isChildOf(Utils::FileName::fromString(target.sourceDirectory)) - && target.sourceDirectory.size() > bestLength) { + if (fileName.isChildOf(Utils::FileName::fromString(target.sourceDirectory)) && + (target.sourceDirectory.size() > bestLength || + (target.sourceDirectory.size() == bestLength && + target.includeFiles.count() > bestIncludeCount))) { bestLength = target.sourceDirectory.size(); + bestIncludeCount = target.includeFiles.count(); bestIndex = i; } } diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index 5508254919c..274d14e0f65 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -254,7 +254,7 @@ Command *ActionManager::registerAction(QAction *action, Id id, const Context &co if (a) { a->addOverrideAction(action, context, scriptable); emit m_instance->commandListChanged(); - emit m_instance->commandAdded(id.toString()); + emit m_instance->commandAdded(id); } return a; } diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.h b/src/plugins/coreplugin/actionmanager/actionmanager.h index 3f83b81018b..3f0dc846e4c 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager.h @@ -73,7 +73,7 @@ public: signals: void commandListChanged(); - void commandAdded(const QString &id); + void commandAdded(Core::Id id); private: ActionManager(QObject *parent = 0); diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp index 70b60d5c6c2..c70c2c013d9 100644 --- a/src/plugins/coreplugin/actionmanager/command.cpp +++ b/src/plugins/coreplugin/actionmanager/command.cpp @@ -421,18 +421,22 @@ bool Action::hasAttribute(Command::CommandAttribute attr) const } +void Command::augmentActionWithShortcutToolTip(QAction *a) const +{ + a->setToolTip(stringWithAppendedShortcut(a->text())); + QObject::connect(this, &Core::Command::keySequenceChanged, a, [this, a]() { + a->setToolTip(stringWithAppendedShortcut(a->text())); + }); + QObject::connect(a, &QAction::changed, this, [this, a]() { + a->setToolTip(stringWithAppendedShortcut(a->text())); + }); +} + QToolButton *Command::toolButtonWithAppendedShortcut(QAction *action, Command *cmd) { QToolButton *button = new QToolButton; button->setDefaultAction(action); - if (cmd) { - action->setToolTip(cmd->stringWithAppendedShortcut(action->text())); - QObject::connect(cmd, &Core::Command::keySequenceChanged, action, [cmd, action]() { - action->setToolTip(cmd->stringWithAppendedShortcut(action->text())); - }); - QObject::connect(action, &QAction::changed, cmd, [cmd, action]() { - action->setToolTip(cmd->stringWithAppendedShortcut(action->text())); - }); - } + if (cmd) + cmd->augmentActionWithShortcutToolTip(action); return button; } diff --git a/src/plugins/coreplugin/actionmanager/command.h b/src/plugins/coreplugin/actionmanager/command.h index 3bd25ececf1..c643c7a90fd 100644 --- a/src/plugins/coreplugin/actionmanager/command.h +++ b/src/plugins/coreplugin/actionmanager/command.h @@ -88,6 +88,7 @@ public: virtual void setKeySequence(const QKeySequence &key) = 0; virtual QString stringWithAppendedShortcut(const QString &str) const = 0; + void augmentActionWithShortcutToolTip(QAction *action) const; static QToolButton *toolButtonWithAppendedShortcut(QAction *action, Command *cmd); virtual bool isScriptable() const = 0; diff --git a/src/plugins/coreplugin/basefilewizardfactory.cpp b/src/plugins/coreplugin/basefilewizardfactory.cpp index 5db42a69269..032a76bd291 100644 --- a/src/plugins/coreplugin/basefilewizardfactory.cpp +++ b/src/plugins/coreplugin/basefilewizardfactory.cpp @@ -379,9 +379,9 @@ BaseFileWizardFactory::OverwriteResult BaseFileWizardFactory::promptOverwrite(Ge static const QString symLinkMsg = tr("[symbolic link]"); foreach (const GeneratedFile &file, *files) { - const QFileInfo fi(file.path()); - if (fi.exists()) - existingFiles.append(file.path()); + const QString path = file.path(); + if (QFileInfo::exists(path)) + existingFiles.append(path); } if (existingFiles.isEmpty()) return OverwriteOk; diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index e77dec4fee9..62be9d7c2e9 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -131,6 +131,8 @@ void CorePlugin::parseArguments(const QStringList &arguments) Theme *theme = new Theme(qApp); theme->readSettings(themeSettings); setCreatorTheme(theme); + if (theme->flag(Theme::ApplyThemePaletteGlobally)) + QApplication::setPalette(creatorTheme()->palette(QApplication::palette())); // defer creation of these widgets until here, // because they need a valid theme set diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 4dc85dbfa11..0bd10af7ae1 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -679,8 +679,7 @@ void EditorManagerPrivate::doEscapeKeyFocusMoveMagic() if (findPane && findPane->isVisible() && findPane->isUsedByWidget(focus)) { findPane->hide(); stuffHidden = true; - } - if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) { + } else if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) { QWidget *outputPane = OutputPanePlaceHolder::getCurrent(); if (outputPane && outputPane->isVisible() && outputPane->window() == activeWindow) { OutputPaneManager::instance()->slotHide(); @@ -691,6 +690,10 @@ void EditorManagerPrivate::doEscapeKeyFocusMoveMagic() RightPaneWidget::instance()->setShown(false); stuffHidden = true; } + if (findPane && findPane->isVisible() && findPane->window() == activeWindow) { + findPane->hide(); + stuffHidden = true; + } } if (stuffHidden) return; diff --git a/src/plugins/coreplugin/find/currentdocumentfind.cpp b/src/plugins/coreplugin/find/currentdocumentfind.cpp index 1f1cafddadd..8a6b5aa2c37 100644 --- a/src/plugins/coreplugin/find/currentdocumentfind.cpp +++ b/src/plugins/coreplugin/find/currentdocumentfind.cpp @@ -72,9 +72,9 @@ bool CurrentDocumentFind::isEnabled() const return m_currentFind && (!m_currentWidget || m_currentWidget->isVisible()); } -bool CurrentDocumentFind::candidateIsEnabled() const +IFindSupport *CurrentDocumentFind::candidate() const { - return (m_candidateFind != 0); + return m_candidateFind; } bool CurrentDocumentFind::supportsReplace() const diff --git a/src/plugins/coreplugin/find/currentdocumentfind.h b/src/plugins/coreplugin/find/currentdocumentfind.h index 67dc980869b..d67f22699fa 100644 --- a/src/plugins/coreplugin/find/currentdocumentfind.h +++ b/src/plugins/coreplugin/find/currentdocumentfind.h @@ -53,7 +53,7 @@ public: QString completedFindString() const; bool isEnabled() const; - bool candidateIsEnabled() const; + IFindSupport *candidate() const; void highlightAll(const QString &txt, FindFlags findFlags); IFindSupport::Result findIncremental(const QString &txt, FindFlags findFlags); IFindSupport::Result findStep(const QString &txt, FindFlags findFlags); diff --git a/src/plugins/coreplugin/find/findplugin.cpp b/src/plugins/coreplugin/find/findplugin.cpp index af36480441e..f5c99374256 100644 --- a/src/plugins/coreplugin/find/findplugin.cpp +++ b/src/plugins/coreplugin/find/findplugin.cpp @@ -181,8 +181,7 @@ void FindPlugin::openFindFilter() void FindPlugin::openFindDialog(IFindFilter *filter) { - if (d->m_currentDocumentFind->candidateIsEnabled()) - d->m_currentDocumentFind->acceptCandidate(); + d->m_currentDocumentFind->acceptCandidate(); const QString currentFindString = d->m_currentDocumentFind->isEnabled() ? d->m_currentDocumentFind->currentFindString() : QString(); diff --git a/src/plugins/coreplugin/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp index 3f4989e4257..4d3d160aba0 100644 --- a/src/plugins/coreplugin/find/findtoolbar.cpp +++ b/src/plugins/coreplugin/find/findtoolbar.cpp @@ -144,6 +144,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen // register actions Core::Context globalcontext(Core::Constants::C_GLOBAL); + Core::Context findcontext(Constants::C_FINDTOOLBAR); Core::ActionContainer *mfind = Core::ActionManager::actionContainer(Constants::M_FIND); Core::Command *cmd; @@ -151,7 +152,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_goToCurrentFindAction = new QAction(this); Core::ActionManager::registerAction(m_goToCurrentFindAction, Constants::S_RETURNTOEDITOR, - Context(Constants::C_FINDTOOLBAR)); + findcontext); connect(m_goToCurrentFindAction, SIGNAL(triggered()), this, SLOT(setFocusToCurrentFindSupport())); QIcon icon = QIcon::fromTheme(QLatin1String("edit-find-replace")); @@ -161,6 +162,14 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT); connect(m_findInDocumentAction, SIGNAL(triggered()), this, SLOT(openFind())); + // Pressing the find shortcut while focus is in the tool bar should not change the search text, + // so register a different find action for the tool bar + auto localFindAction = new QAction(this); + cmd = ActionManager::registerAction(localFindAction, Constants::FIND_IN_DOCUMENT, findcontext); + connect(localFindAction, &QAction::triggered, this, [this]() { + openFindToolBar(FindToolBar::OpenFlags(UpdateAll & ~UpdateFindText)); + }); + if (QApplication::clipboard()->supportsFindBuffer()) { m_enterFindStringAction = new QAction(tr("Enter Find String"), this); cmd = Core::ActionManager::registerAction(m_enterFindStringAction, "Find.EnterFindString", globalcontext); @@ -174,15 +183,23 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen cmd = Core::ActionManager::registerAction(m_findNextAction, Constants::FIND_NEXT, globalcontext); cmd->setDefaultKeySequence(QKeySequence::FindNext); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(invokeFindNext())); - m_ui.findNextButton->setDefaultAction(cmd->action()); + connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(invokeGlobalFindNext())); + m_localFindNextAction = new QAction(m_findNextAction->text(), this); + cmd = ActionManager::registerAction(m_localFindNextAction, Constants::FIND_NEXT, findcontext); + cmd->augmentActionWithShortcutToolTip(m_localFindNextAction); + connect(m_localFindNextAction, &QAction::triggered, this, &FindToolBar::invokeFindNext); + m_ui.findNextButton->setDefaultAction(m_localFindNextAction); m_findPreviousAction = new QAction(tr("Find Previous"), this); cmd = Core::ActionManager::registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS, globalcontext); cmd->setDefaultKeySequence(QKeySequence::FindPrevious); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(invokeFindPrevious())); - m_ui.findPreviousButton->setDefaultAction(cmd->action()); + connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(invokeGlobalFindPrevious())); + m_localFindPreviousAction = new QAction(m_findPreviousAction->text(), this); + cmd = ActionManager::registerAction(m_localFindPreviousAction, Constants::FIND_PREVIOUS, findcontext); + cmd->augmentActionWithShortcutToolTip(m_localFindPreviousAction); + connect(m_localFindPreviousAction, &QAction::triggered, this, &FindToolBar::invokeFindPrevious); + m_ui.findPreviousButton->setDefaultAction(m_localFindPreviousAction); m_findNextSelectedAction = new QAction(tr("Find Next (Selected)"), this); cmd = Core::ActionManager::registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED, globalcontext); @@ -200,29 +217,43 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen cmd = Core::ActionManager::registerAction(m_replaceAction, Constants::REPLACE, globalcontext); cmd->setDefaultKeySequence(QKeySequence()); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - connect(m_replaceAction, SIGNAL(triggered()), this, SLOT(invokeReplace())); - m_ui.replaceButton->setDefaultAction(cmd->action()); + connect(m_replaceAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplace())); + m_localReplaceAction = new QAction(m_replaceAction->text(), this); + cmd = ActionManager::registerAction(m_localReplaceAction, Constants::REPLACE, findcontext); + cmd->augmentActionWithShortcutToolTip(m_localReplaceAction); + connect(m_localReplaceAction, &QAction::triggered, this, &FindToolBar::invokeReplace); + m_ui.replaceButton->setDefaultAction(m_localReplaceAction); m_replaceNextAction = new QAction(tr("Replace && Find"), this); m_replaceNextAction->setIconText(tr("Replace && Find")); // work around bug in Qt that kills ampersands in tool button cmd = Core::ActionManager::registerAction(m_replaceNextAction, Constants::REPLACE_NEXT, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+="))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - connect(m_replaceNextAction, SIGNAL(triggered()), this, SLOT(invokeReplaceNext())); - m_ui.replaceNextButton->setDefaultAction(cmd->action()); + connect(m_replaceNextAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplaceNext())); + m_localReplaceNextAction = new QAction(m_replaceNextAction->text(), this); + cmd = ActionManager::registerAction(m_localReplaceNextAction, Constants::REPLACE_NEXT, findcontext); + cmd->augmentActionWithShortcutToolTip(m_localReplaceNextAction); + connect(m_localReplaceNextAction, &QAction::triggered, this, &FindToolBar::invokeReplaceNext); + m_ui.replaceNextButton->setDefaultAction(m_localReplaceNextAction); m_replacePreviousAction = new QAction(tr("Replace && Find Previous"), this); cmd = Core::ActionManager::registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS, globalcontext); - // shortcut removed, clashes with Ctrl++ on many keyboard layouts - //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+="))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - connect(m_replacePreviousAction, SIGNAL(triggered()), this, SLOT(invokeReplacePrevious())); + connect(m_replacePreviousAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplacePrevious())); + m_localReplacePreviousAction = new QAction(m_replacePreviousAction->text(), this); + cmd = ActionManager::registerAction(m_localReplacePreviousAction, Constants::REPLACE_PREVIOUS, findcontext); + cmd->augmentActionWithShortcutToolTip(m_localReplacePreviousAction); + connect(m_localReplacePreviousAction, &QAction::triggered, this, &FindToolBar::invokeReplacePrevious); m_replaceAllAction = new QAction(tr("Replace All"), this); cmd = Core::ActionManager::registerAction(m_replaceAllAction, Constants::REPLACE_ALL, globalcontext); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - connect(m_replaceAllAction, SIGNAL(triggered()), this, SLOT(invokeReplaceAll())); - m_ui.replaceAllButton->setDefaultAction(cmd->action()); + connect(m_replaceAllAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplaceAll())); + m_localReplaceAllAction = new QAction(m_replaceAllAction->text(), this); + cmd = ActionManager::registerAction(m_localReplaceAllAction, Constants::REPLACE_ALL, findcontext); + cmd->augmentActionWithShortcutToolTip(m_localReplaceAllAction); + connect(m_localReplaceAllAction, &QAction::triggered, this, &FindToolBar::invokeReplaceAll); + m_ui.replaceAllButton->setDefaultAction(m_localReplaceAllAction); m_caseSensitiveAction = new QAction(tr("Case Sensitive"), this); m_caseSensitiveAction->setIcon(QIcon(QLatin1String(":/find/images/casesensitively.png"))); @@ -256,8 +287,13 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen mfind->addAction(cmd, Constants::G_FIND_FLAGS); connect(m_preserveCaseAction, SIGNAL(toggled(bool)), this, SLOT(setPreserveCase(bool))); - connect(m_currentDocumentFind, SIGNAL(candidateChanged()), this, SLOT(adaptToCandidate())); - connect(m_currentDocumentFind, SIGNAL(changed()), this, SLOT(updateToolBar())); + connect(m_currentDocumentFind, &CurrentDocumentFind::candidateChanged, + this, &FindToolBar::adaptToCandidate); + connect(m_currentDocumentFind, &CurrentDocumentFind::changed, + this, &FindToolBar::updateGlobalActions); + connect(m_currentDocumentFind, &CurrentDocumentFind::changed, + this, &FindToolBar::updateToolBar); + updateGlobalActions(); updateToolBar(); m_findIncrementalTimer.setSingleShot(true); @@ -326,7 +362,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event) void FindToolBar::adaptToCandidate() { - updateFindAction(); + updateGlobalActions(); if (findToolBarPlaceHolder() == Core::FindToolBarPlaceHolder::getCurrent()) { m_currentDocumentFind->acceptCandidate(); if (isVisible()) @@ -334,14 +370,22 @@ void FindToolBar::adaptToCandidate() } } -void FindToolBar::updateFindAction() +void FindToolBar::updateGlobalActions() { - bool enabled = m_currentDocumentFind->candidateIsEnabled(); - m_findInDocumentAction->setEnabled((toolBarHasFocus() && isEnabled()) || enabled); + IFindSupport *candidate = m_currentDocumentFind->candidate(); + bool enabled = (candidate != 0); + bool replaceEnabled = enabled && candidate->supportsReplace(); + m_findInDocumentAction->setEnabled(enabled || (toolBarHasFocus() && isEnabled())); m_findNextSelectedAction->setEnabled(enabled); m_findPreviousSelectedAction->setEnabled(enabled); if (QApplication::clipboard()->supportsFindBuffer()) m_enterFindStringAction->setEnabled(enabled); + m_findNextAction->setEnabled(enabled); + m_findPreviousAction->setEnabled(enabled); + m_replaceAction->setEnabled(replaceEnabled); + m_replaceNextAction->setEnabled(replaceEnabled); + m_replacePreviousAction->setEnabled(replaceEnabled); + m_replaceAllAction->setEnabled(replaceEnabled); } void FindToolBar::updateToolBar() @@ -350,13 +394,13 @@ void FindToolBar::updateToolBar() bool replaceEnabled = enabled && m_currentDocumentFind->supportsReplace(); bool showAllControls = canShowAllControls(replaceEnabled); - m_findNextAction->setEnabled(enabled); - m_findPreviousAction->setEnabled(enabled); + m_localFindNextAction->setEnabled(enabled); + m_localFindPreviousAction->setEnabled(enabled); - m_replaceAction->setEnabled(replaceEnabled); - m_replaceNextAction->setEnabled(replaceEnabled); - m_replacePreviousAction->setEnabled(replaceEnabled); - m_replaceAllAction->setEnabled(replaceEnabled); + m_localReplaceAction->setEnabled(replaceEnabled); + m_localReplacePreviousAction->setEnabled(replaceEnabled); + m_localReplaceNextAction->setEnabled(replaceEnabled); + m_localReplaceAllAction->setEnabled(replaceEnabled); m_caseSensitiveAction->setEnabled(enabled); m_wholeWordAction->setEnabled(enabled); @@ -419,12 +463,24 @@ void FindToolBar::invokeFindNext() invokeFindStep(); } +void FindToolBar::invokeGlobalFindNext() +{ + acceptCandidateAndMoveToolBar(); + invokeFindNext(); +} + void FindToolBar::invokeFindPrevious() { setFindFlag(FindBackward, true); invokeFindStep(); } +void FindToolBar::invokeGlobalFindPrevious() +{ + acceptCandidateAndMoveToolBar(); + invokeFindPrevious(); +} + QString FindToolBar::getFindText() { return m_ui.findEdit->text(); @@ -488,18 +544,36 @@ void FindToolBar::invokeReplace() } } +void FindToolBar::invokeGlobalReplace() +{ + acceptCandidateAndMoveToolBar(); + invokeReplace(); +} + void FindToolBar::invokeReplaceNext() { setFindFlag(FindBackward, false); invokeReplaceStep(); } +void FindToolBar::invokeGlobalReplaceNext() +{ + acceptCandidateAndMoveToolBar(); + invokeReplaceNext(); +} + void FindToolBar::invokeReplacePrevious() { setFindFlag(FindBackward, true); invokeReplaceStep(); } +void FindToolBar::invokeGlobalReplacePrevious() +{ + acceptCandidateAndMoveToolBar(); + invokeReplacePrevious(); +} + void FindToolBar::invokeReplaceStep() { if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) { @@ -517,6 +591,12 @@ void FindToolBar::invokeReplaceAll() m_currentDocumentFind->replaceAll(getFindText(), getReplaceText(), effectiveFindFlags()); } +void FindToolBar::invokeGlobalReplaceAll() +{ + acceptCandidateAndMoveToolBar(); + invokeReplaceAll(); +} + void FindToolBar::invokeResetIncrementalSearch() { m_findIncrementalTimer.stop(); @@ -531,7 +611,6 @@ void FindToolBar::putSelectionToFindClipboard() openFind(false); const QString text = m_currentDocumentFind->currentFindString(); QApplication::clipboard()->setText(text, QClipboard::FindBuffer); - setFindText(text); } @@ -666,13 +745,37 @@ bool FindToolBar::canShowAllControls(bool replaceIsVisible) const return fullWidth - replaceFixedWidth >= MINIMUM_WIDTH_FOR_COMPLEX_LAYOUT; } +/*! + Accepts the candidate find of the current focus widget (if any), and moves the tool bar + there, if it was visible before. +*/ +void FindToolBar::acceptCandidateAndMoveToolBar() +{ + if (!m_currentDocumentFind->candidate()) + return; + if (isVisible()) { + openFindToolBar(UpdateHighlight); + } else { + // Make sure we are really hidden, and not just because our parent was hidden. + // Otherwise when the tool bar gets visible again, it will be in a different widget than + // the current document find it acts on. + // Test case: Open find in navigation side bar, hide side bar, click into editor, + // trigger find next, show side bar + hide(); + m_currentDocumentFind->acceptCandidate(); + } +} + void FindToolBar::openFind(bool focus) { setBackward(false); - openFindToolBar(focus); + OpenFlags flags = UpdateAll; + if (!focus) // remove focus flag + flags = flags & ~UpdateFocusAndSelect; + openFindToolBar(flags); } -void FindToolBar::openFindToolBar(bool focus) +void FindToolBar::openFindToolBar(OpenFlags flags) { installEventFilters(); Core::FindToolBarPlaceHolder *holder = findToolBarPlaceHolder(); @@ -688,30 +791,33 @@ void FindToolBar::openFindToolBar(bool focus) m_currentDocumentFind->acceptCandidate(); holder->setVisible(true); setVisible(true); - // We do not want to change the text when we currently have the focus and user presses the - // find shortcut - if (!focus || !toolBarHasFocus()) { +// We do not want to change the text when we currently have the focus and user presses the +// find shortcut +// if (!focus || !toolBarHasFocus()) { + if (flags & UpdateFindText) { QString text = m_currentDocumentFind->currentFindString(); if (!text.isEmpty()) setFindText(text); } - if (focus) + if (flags & UpdateFocusAndSelect) setFocus(); - m_currentDocumentFind->defineFindScope(); - m_currentDocumentFind->highlightAll(getFindText(), effectiveFindFlags()); - if (focus) + if (flags & UpdateFindScope) + m_currentDocumentFind->defineFindScope(); + if (flags & UpdateHighlight) + m_currentDocumentFind->highlightAll(getFindText(), effectiveFindFlags()); + if (flags & UpdateFocusAndSelect) selectFindText(); } void FindToolBar::findNextSelected() { - openFind(false); + openFindToolBar(OpenFlags(UpdateAll & ~UpdateFocusAndSelect)); invokeFindNext(); } void FindToolBar::findPreviousSelected() { - openFind(false); + openFindToolBar(OpenFlags(UpdateAll & ~UpdateFocusAndSelect)); invokeFindPrevious(); } diff --git a/src/plugins/coreplugin/find/findtoolbar.h b/src/plugins/coreplugin/find/findtoolbar.h index b0694e0ef14..b01212a5fc6 100644 --- a/src/plugins/coreplugin/find/findtoolbar.h +++ b/src/plugins/coreplugin/find/findtoolbar.h @@ -75,13 +75,22 @@ class FindToolBar : public Utils::StyledBar Q_OBJECT public: + enum OpenFlag { + UpdateFocusAndSelect = 0x01, + UpdateFindScope = 0x02, + UpdateFindText = 0x04, + UpdateHighlight = 0x08, + UpdateAll = 0x0F + }; + Q_DECLARE_FLAGS(OpenFlags, OpenFlag) + explicit FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumentFind); ~FindToolBar(); void readSettings(); void writeSettings(); - void openFindToolBar(bool focus = true); + void openFindToolBar(OpenFlags flags = UpdateAll); void setUseFakeVim(bool on); void setLightColoredIcon(bool lightColored); @@ -90,13 +99,19 @@ public slots: private slots: void invokeFindNext(); + void invokeGlobalFindNext(); void invokeFindPrevious(); + void invokeGlobalFindPrevious(); void invokeFindStep(); void invokeReplace(); + void invokeGlobalReplace(); void invokeReplaceNext(); + void invokeGlobalReplaceNext(); void invokeReplacePrevious(); + void invokeGlobalReplacePrevious(); void invokeReplaceStep(); void invokeReplaceAll(); + void invokeGlobalReplaceAll(); void invokeResetIncrementalSearch(); void invokeFindIncremental(); @@ -109,7 +124,7 @@ private slots: void openFind(bool focus = true); void findNextSelected(); void findPreviousSelected(); - void updateFindAction(); + void updateGlobalActions(); void updateToolBar(); void findFlagsChanged(); void findEditButtonClicked(); @@ -136,6 +151,7 @@ private: Core::FindToolBarPlaceHolder *findToolBarPlaceHolder() const; bool toolBarHasFocus() const; bool canShowAllControls(bool replaceIsVisible) const; + void acceptCandidateAndMoveToolBar(); bool eventFilter(QObject *obj, QEvent *event); void setFindText(const QString &text); @@ -165,6 +181,14 @@ private: QAction *m_wholeWordAction; QAction *m_regularExpressionAction; QAction *m_preserveCaseAction; + + QAction *m_localFindNextAction; + QAction *m_localFindPreviousAction; + QAction *m_localReplaceAction; + QAction *m_localReplaceNextAction; + QAction *m_localReplacePreviousAction; + QAction *m_localReplaceAllAction; + FindFlags m_findFlags; QTimer m_findIncrementalTimer; diff --git a/src/plugins/coreplugin/helpmanager.cpp b/src/plugins/coreplugin/helpmanager.cpp index f5b159e143d..61a6e744ded 100644 --- a/src/plugins/coreplugin/helpmanager.cpp +++ b/src/plugins/coreplugin/helpmanager.cpp @@ -441,7 +441,7 @@ void HelpManager::verifyDocumenation() { const QStringList ®isteredDocs = d->m_helpEngine->registeredDocumentations(); foreach (const QString &nameSpace, registeredDocs) { - if (!QFileInfo(d->m_helpEngine->documentationFileName(nameSpace)).exists()) + if (!QFileInfo::exists(d->m_helpEngine->documentationFileName(nameSpace))) d->m_nameSpacesToUnregister.append(nameSpace); } } diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 2dd615469a4..495b202fe42 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -410,8 +410,7 @@ QString ICore::userResourcePath() const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path(); const QString urp = configDir + QLatin1String("/qtcreator"); - QFileInfo fi(urp + QLatin1Char('/')); - if (!fi.exists()) { + if (!QFileInfo::exists(urp + QLatin1Char('/'))) { QDir dir; if (!dir.mkpath(urp)) qWarning() << "could not create" << urp; diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp index 87dd02cef25..0a2a98efb98 100644 --- a/src/plugins/coreplugin/locator/filesystemfilter.cpp +++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp @@ -134,7 +134,7 @@ QList FileSystemFilter::matchesFor(QFutureInterfaceobjectName(); - if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()) { - if (baseName == QLatin1String("windows")) { - // Sometimes we get the standard windows 95 style as a fallback - if (QStyleFactory::keys().contains(QLatin1String("Fusion"))) { - baseName = QLatin1String("fusion"); // Qt5 - } else { // Qt4 - // e.g. if we are running on a KDE4 desktop - QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION"); - if (desktopEnvironment == "kde") - baseName = QLatin1String("plastique"); - else - baseName = QLatin1String("cleanlooks"); - } + // Sometimes we get the standard windows 95 style as a fallback + if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost() + && baseName == QLatin1String("windows")) { + baseName = QLatin1String("fusion"); + } + + // if the user has specified as base style in the theme settings, + // prefer that + const QStringList available = QStyleFactory::keys(); + foreach (const QString &s, Utils::creatorTheme()->preferredStyles()) { + if (available.contains(s, Qt::CaseInsensitive)) { + baseName = s; + break; } } - qApp->setStyle(new ManhattanStyle(baseName)); + + QApplication::setStyle(new ManhattanStyle(baseName)); setDockNestingEnabled(true); diff --git a/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.cpp b/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.cpp index c21766d989d..0430c2630f6 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.cpp +++ b/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.cpp @@ -87,15 +87,10 @@ QWidget *ThemeSettingsItemDelegate::createColorEditor(QWidget *parent, const QSt const bool isUnnamed = colorRole->colorVariable()->variableName().isEmpty(); const QColor currentColor = colorRole->colorVariable()->color(); - int k = 0; - if (isUnnamed) { - cb->addItem(makeIcon(currentColor), tr(" (current)")); - ++k; - } else { - cb->addItem(makeIcon(currentColor), - colorRole->colorVariable()->variableName()+QString(tr(" (current)"))); - ++k; - } + cb->addItem(makeIcon(currentColor), + isUnnamed ? tr(" (Current)") + : colorRole->colorVariable()->variableName() + tr(" (Current)")); + int k = 1; foreach (ColorVariable::Ptr namedColor, model->m_colors->colorVariables()) { if (namedColor->variableName().isEmpty()) @@ -109,10 +104,10 @@ QWidget *ThemeSettingsItemDelegate::createColorEditor(QWidget *parent, const QSt } if (!isUnnamed) { - cb->addItem(tr("Make unnamed")); + cb->addItem(tr("Remove Variable Name")); m_actions[k++] = qMakePair(Action_MakeUnnamed, QSharedPointer(0)); } - cb->addItem(tr("Create new name...")); + cb->addItem(tr("Add Variable Name...")); m_actions[k++] = qMakePair(Action_CreateNew, QSharedPointer(0)); connect(cb, static_cast(&QComboBox::activated), @@ -139,6 +134,7 @@ QWidget *ThemeSettingsItemDelegate::createEditor(QWidget *parent, const QStyleOp QMetaEnum e = Theme::staticMetaObject.enumerator(Theme::staticMetaObject.indexOfEnumerator("WidgetStyle")); for (int i = 0, total = e.keyCount(); i < total; ++i) cb->addItem(QLatin1String(e.key(i))); + cb->setCurrentIndex(model->m_widgetStyle); connect(cb, static_cast(&QComboBox::activated), this, [this, cb]() { ThemeSettingsItemDelegate *me = const_cast(this); @@ -148,16 +144,13 @@ QWidget *ThemeSettingsItemDelegate::createEditor(QWidget *parent, const QStyleOp m_comboBox = cb; return cb; } - case ThemeSettingsTableModel::SectionColors: { + case ThemeSettingsTableModel::SectionColors: return createColorEditor(parent, option, index); - } - case ThemeSettingsTableModel::SectionFlags: { + case ThemeSettingsTableModel::SectionFlags: return QStyledItemDelegate::createEditor(parent, option, index); - } - default: { + default: qWarning("unhandled section"); return 0; - } } // switch } @@ -166,7 +159,7 @@ void ThemeSettingsItemDelegate::setEditorData(QWidget *editor, const QModelIndex QStyledItemDelegate::setEditorData(editor, index); } -void ThemeSettingsItemDelegate::setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const +void ThemeSettingsItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { ThemeSettingsTableModel *themeSettingsModel = qobject_cast(sourceModel(model)); @@ -199,7 +192,7 @@ void ThemeSettingsItemDelegate::setModelData (QWidget *editor, QAbstractItemMode ColorVariable::Ptr anonymousColor = themeSettingsModel->m_colors->createVariable(previousVariable->color()); themeColor->assignColorVariable(anonymousColor); } else if (act == Action_CreateNew) { - QString name = QInputDialog::getText(editor, tr("New variable name"), tr("Variable name:")); + QString name = QInputDialog::getText(editor, tr("Add Variable Name"), tr("Variable name:")); if (!name.isEmpty()) { previousVariable->removeReference(themeColor.data()); diff --git a/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.h b/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.h index 02023284baa..bf0d1b99e0f 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.h +++ b/src/plugins/coreplugin/themeeditor/themesettingsitemdelegate.h @@ -58,7 +58,7 @@ class ThemeSettingsItemDelegate : public QStyledItemDelegate public: ThemeSettingsItemDelegate(QObject *parent); - QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const Q_DECL_OVERRIDE; diff --git a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp index 20a607dba84..87826f87bb4 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp +++ b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp @@ -236,6 +236,7 @@ void ThemeSettingsTableModel::initFrom(Theme *theme) m_widgetStyle = theme->widgetStyle(); m_name = theme->d->name; + m_preferredStyles = theme->d->preferredStyles; } void ThemeSettingsTableModel::toTheme(Theme *t) const @@ -265,6 +266,7 @@ void ThemeSettingsTableModel::toTheme(Theme *t) const theme->widgetStyle = m_widgetStyle; theme->name = m_name; + theme->preferredStyles = m_preferredStyles; emit t->changed(); } diff --git a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h index 720c07e4e71..ea7cf4db394 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h +++ b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h @@ -78,6 +78,7 @@ public: void toTheme(Utils::Theme *theme) const; QString m_name; + QStringList m_preferredStyles; public: ThemeColors::Ptr m_colors; diff --git a/src/plugins/coreplugin/themesettings.cpp b/src/plugins/coreplugin/themesettings.cpp index 75fd3ed2f52..1332e59d861 100644 --- a/src/plugins/coreplugin/themesettings.cpp +++ b/src/plugins/coreplugin/themesettings.cpp @@ -434,6 +434,8 @@ void ThemeSettings::apply() { d->m_ui->editor->model()->toTheme(creatorTheme()); + if (creatorTheme()->flag(Theme::ApplyThemePaletteGlobally)) + QApplication::setPalette(creatorTheme()->palette(QApplication::palette())); foreach (QWidget *w, QApplication::topLevelWidgets()) w->update(); } diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index 9856a323d48..b0d3d1dd174 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -260,7 +260,7 @@ VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent) void VariableGroupItem::populateGroup(MacroExpander *expander) { - foreach (const QByteArray &variable, expander->variables()) { + foreach (const QByteArray &variable, expander->visibleVariables()) { auto item = new VariableItem; item->m_variable = QString::fromUtf8(variable); item->m_expander = expander; @@ -372,6 +372,18 @@ void VariableChooser::addSupportedWidget(QWidget *textcontrol, const QByteArray textcontrol->setProperty(kVariableNameProperty, ownName); } +void VariableChooser::addSupportForChildWidgets(QWidget *parent, MacroExpander *expander) +{ + auto chooser = new VariableChooser(parent); + chooser->addMacroExpanderProvider([expander] { return expander; }); + foreach (QWidget *child, parent->findChildren()) { + if (qobject_cast(child) + || qobject_cast(child) + || qobject_cast(child)) + chooser->addSupportedWidget(child); + } +} + /*! * \internal */ @@ -533,9 +545,14 @@ static bool handleEscapePressed(QKeyEvent *ke, QWidget *widget) /*! * \internal */ -void VariableChooser::keyPressEvent(QKeyEvent *ev) +bool VariableChooser::event(QEvent *ev) { - handleEscapePressed(ev, this); + if (ev->type() == QEvent::KeyPress || ev->type() == QEvent::ShortcutOverride) { + QKeyEvent *ke = static_cast(ev); + if (handleEscapePressed(ke, this)) + return true; + } + return QWidget::event(ev); } /*! @@ -545,7 +562,7 @@ bool VariableChooser::eventFilter(QObject *obj, QEvent *event) { if (obj != d->currentWidget()) return false; - if (event->type() == QEvent::KeyPress && isVisible()) { + if ((event->type() == QEvent::KeyPress || event->type() == QEvent::ShortcutOverride) && isVisible()) { QKeyEvent *ke = static_cast(event); return handleEscapePressed(ke, this); } else if (event->type() == QEvent::Resize) { diff --git a/src/plugins/coreplugin/variablechooser.h b/src/plugins/coreplugin/variablechooser.h index 7c4a1568bd2..bc61b931f0a 100644 --- a/src/plugins/coreplugin/variablechooser.h +++ b/src/plugins/coreplugin/variablechooser.h @@ -55,8 +55,10 @@ public: void addMacroExpanderProvider(const Utils::MacroExpanderProvider &provider); void addSupportedWidget(QWidget *textcontrol, const QByteArray &ownName = QByteArray()); + static void addSupportForChildWidgets(QWidget *parent, Utils::MacroExpander *expander); + protected: - void keyPressEvent(QKeyEvent *ev); + bool event(QEvent *ev); bool eventFilter(QObject *, QEvent *event); private: diff --git a/src/plugins/cppeditor/cppautocompleter.cpp b/src/plugins/cppeditor/cppautocompleter.cpp index cdb11b72859..f666a4ea8ee 100644 --- a/src/plugins/cppeditor/cppautocompleter.cpp +++ b/src/plugins/cppeditor/cppautocompleter.cpp @@ -102,7 +102,7 @@ static bool isInStringHelper(const QTextCursor &cursor, Token *retToken = 0) const unsigned pos = cursor.selectionEnd() - cursor.block().position(); - if (tokens.isEmpty() || pos < tokens.first().utf16charsBegin()) + if (tokens.isEmpty() || pos <= tokens.first().utf16charsBegin()) return false; if (pos >= tokens.last().utf16charsEnd()) { @@ -113,7 +113,7 @@ static bool isInStringHelper(const QTextCursor &cursor, Token *retToken = 0) Token tk = tokenAtPosition(tokens, pos); if (retToken) *retToken = tk; - return tk.isStringLiteral(); + return tk.isStringLiteral() && pos > tk.utf16charsBegin(); } bool CppAutoCompleter::contextAllowsAutoParentheses(const QTextCursor &cursor, diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index f3f926472b5..e0852bbc746 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -672,8 +672,10 @@ ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targetOffse // the number of parameters in sourceFunction or targetFunction const int existingParamCount = declaredParameterCount(sourceFunction); - QTC_ASSERT(existingParamCount == declaredParameterCount(targetFunction), return changes); - QTC_ASSERT(existingParamCount == targetParameterDecls.size(), return changes); + if (existingParamCount != declaredParameterCount(targetFunction)) + return changes; + if (existingParamCount != targetParameterDecls.size()) + return changes; const int newParamCount = declaredParameterCount(newFunction); diff --git a/src/plugins/cppeditor/fileandtokenactions_test.cpp b/src/plugins/cppeditor/fileandtokenactions_test.cpp index 4af78e12505..b581f0938c7 100644 --- a/src/plugins/cppeditor/fileandtokenactions_test.cpp +++ b/src/plugins/cppeditor/fileandtokenactions_test.cpp @@ -171,8 +171,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti // Process all files from the projects foreach (const QString filePath, filesToOpen) { // Skip e.g. "" - const QFileInfo fileInfo(filePath); - if (!fileInfo.exists()) + if (!QFileInfo::exists(filePath)) continue; qDebug() << " --" << filePath; diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp index 27d7fea83f0..811552971f6 100644 --- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp +++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp @@ -931,6 +931,45 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_data() "};\n" ); + QTest::newRow("matchFunctionSignature_FollowCall_1") << _( + "class Bar {};\n" + "void $foo(int) {}\n" + "void foo(const char *) {}\n" + "void foo(const Bar &) {}\n" + "void foo(char) {}\n" + "\n" + "void t()\n" + "{\n" + " @foo(5);\n" + "}\n" + ); + + QTest::newRow("matchFunctionSignature_FollowCall_2") << _( + "class Bar {};\n" + "void foo(int) {}\n" + "void $foo(const char *) {}\n" + "void foo(const Bar &) {}\n" + "void foo(char) {}\n" + "\n" + "void t()\n" + "{\n" + " @foo(\"hoo\");\n" + "}\n" + ); + + QTest::newRow("matchFunctionSignature_FollowCall_3") << _( + "class Bar {};\n" + "void foo(int) {}\n" + "void foo(const char *) {}\n" + "void foo(const Bar &) {}\n" + "void $foo(char) {}\n" + "\n" + "void t()\n" + "{\n" + " @foo('a');\n" + "}\n" + ); + QTest::newRow("infiniteLoopLocalTypedef_QTCREATORBUG-11999") << _( "template\n" "class TreeConstIterator\n" diff --git a/src/plugins/cpptools/builtineditordocumentprocessor.cpp b/src/plugins/cpptools/builtineditordocumentprocessor.cpp index 0474ed45e69..d1e23101a99 100644 --- a/src/plugins/cpptools/builtineditordocumentprocessor.cpp +++ b/src/plugins/cpptools/builtineditordocumentprocessor.cpp @@ -46,13 +46,15 @@ #include #include -enum { debug = 0 }; +#include + +static Q_LOGGING_CATEGORY(log, "qtc.cpptools.builtineditordocumentprocessor") namespace { -CppTools::CheckSymbols * createHighlighter(const CPlusPlus::Document::Ptr &doc, - const CPlusPlus::Snapshot &snapshot, - QTextDocument *textDocument) +CppTools::CheckSymbols *createHighlighter(const CPlusPlus::Document::Ptr &doc, + const CPlusPlus::Snapshot &snapshot, + QTextDocument *textDocument) { QTC_ASSERT(doc, return 0); QTC_ASSERT(doc->translationUnit(), return 0); @@ -201,10 +203,7 @@ void BuiltinEditorDocumentProcessor::onParserFinished(CPlusPlus::Document::Ptr d if (document->editorRevision() != revision()) return; // outdated content, wait for a new document to be parsed - if (debug) { - qDebug() << "BuiltinEditorDocumentProcessor: document parsed" << document->fileName() - << document->editorRevision(); - } + qCDebug(log) << "document parsed" << document->fileName() << document->editorRevision(); // Emit ifdefed out blocks const auto ifdefoutBlocks = toTextEditorBlocks(document->skippedBlocks()); @@ -224,10 +223,8 @@ void BuiltinEditorDocumentProcessor::onParserFinished(CPlusPlus::Document::Ptr d void BuiltinEditorDocumentProcessor::onSemanticInfoUpdated(const SemanticInfo semanticInfo) { - if (debug) { - qDebug() << "BuiltinEditorDocumentProcessor: semantic info updated" + qCDebug(log) << "semantic info updated" << semanticInfo.doc->fileName() << semanticInfo.revision << semanticInfo.complete; - } emit semanticInfoUpdated(semanticInfo); diff --git a/src/plugins/cpptools/builtinindexingsupport.cpp b/src/plugins/cpptools/builtinindexingsupport.cpp index 80b212d751d..0295a81c4f5 100644 --- a/src/plugins/cpptools/builtinindexingsupport.cpp +++ b/src/plugins/cpptools/builtinindexingsupport.cpp @@ -52,7 +52,6 @@ using namespace CppTools; using namespace CppTools::Internal; -static const bool DumpFileNameWhileParsing = qgetenv("QTC_DUMP_FILENAME_WHILE_PARSING") == "1"; static const bool FindErrorsIndexing = qgetenv("QTC_FIND_ERRORS_INDEXING") == "1"; namespace { @@ -60,12 +59,8 @@ namespace { class ParseParams { public: - ParseParams() - : dumpFileNameWhileParsing(DumpFileNameWhileParsing) - , revision(0) - {} + ParseParams() : revision(0) {} - int dumpFileNameWhileParsing; int revision; ProjectPart::HeaderPaths headerPaths; WorkingCopy workingCopy; @@ -192,12 +187,10 @@ void indexFindErrors(QFutureInterface &future, const ParseParams params) void index(QFutureInterface &future, const ParseParams params) { QScopedPointer sourceProcessor(CppModelManager::createSourceProcessor()); - sourceProcessor->setDumpFileNameWhileParsing(params.dumpFileNameWhileParsing); sourceProcessor->setRevision(params.revision); sourceProcessor->setHeaderPaths(params.headerPaths); sourceProcessor->setWorkingCopy(params.workingCopy); - QStringList sources; QStringList headers; classifyFiles(params.sourceFiles, &headers, &sources); diff --git a/src/plugins/cpptools/cpplocatordata.cpp b/src/plugins/cpptools/cpplocatordata.cpp index 9d10f0f434f..4d87c2f5a58 100644 --- a/src/plugins/cpptools/cpplocatordata.cpp +++ b/src/plugins/cpptools/cpplocatordata.cpp @@ -61,7 +61,7 @@ void CppLocatorData::onDocumentUpdated(const CPlusPlus::Document::Ptr &document) } } - if (i == ei) + if (i == ei && QFileInfo(document->fileName()).suffix() != QLatin1String("moc")) m_pendingDocuments.append(document); flushPendingDocument(false); diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp index cb51113d39a..dfc1ed0d0d7 100644 --- a/src/plugins/cpptools/cppmodelmanager_test.cpp +++ b/src/plugins/cpptools/cppmodelmanager_test.cpp @@ -123,7 +123,7 @@ public: ExampleProjectConfigurator(const QString &projectFile) { const QString projectUserFile = projectFile + _(".user"); - QVERIFY(!QFileInfo(projectUserFile).exists()); + QVERIFY(!QFileInfo::exists(projectUserFile)); // Open project QString errorOpeningProject; diff --git a/src/plugins/cpptools/cppsemanticinfoupdater.cpp b/src/plugins/cpptools/cppsemanticinfoupdater.cpp index 3d3b5b42a60..2ee0501aa72 100644 --- a/src/plugins/cpptools/cppsemanticinfoupdater.cpp +++ b/src/plugins/cpptools/cppsemanticinfoupdater.cpp @@ -39,11 +39,15 @@ #include #include +#include + enum { debug = 0 }; using namespace CPlusPlus; using namespace CppTools; +static Q_LOGGING_CATEGORY(log, "qtc.cpptools.semanticinfoupdater") + namespace CppTools { class SemanticInfoUpdaterPrivate @@ -105,8 +109,7 @@ void SemanticInfoUpdaterPrivate::setSemanticInfo(const SemanticInfo &semanticInf m_semanticInfo = semanticInfo; } if (emitSignal) { - if (debug) - qDebug() << "SemanticInfoUpdater: emiting new info"; + qCDebug(log) << "emiting new info"; emit q->updated(semanticInfo); } } @@ -115,9 +118,6 @@ SemanticInfo SemanticInfoUpdaterPrivate::update(const SemanticInfo::Source &sour bool emitSignalWhenFinished, FuturizedTopLevelDeclarationProcessor *processor) { - if (debug) - qDebug() << "SemanticInfoUpdater: update() - source revision" << source.revision; - SemanticInfo newSemanticInfo; newSemanticInfo.revision = source.revision; newSemanticInfo.snapshot = source.snapshot; @@ -130,9 +130,8 @@ SemanticInfo SemanticInfoUpdaterPrivate::update(const SemanticInfo::Source &sour newSemanticInfo.complete = false; newSemanticInfo.doc = doc; - if (debug) - qDebug() << "SemanticInfoUpdater: update() - re-calculated document. Canceled =" - << !newSemanticInfo.complete; + qCDebug(log) << "update() for source revision:" << source.revision + << "canceled:" << !newSemanticInfo.complete; setSemanticInfo(newSemanticInfo, emitSignalWhenFinished); return newSemanticInfo; @@ -156,9 +155,7 @@ bool SemanticInfoUpdaterPrivate::reuseCurrentSemanticInfo(const SemanticInfo::So newSemanticInfo.snapshot = source.snapshot; newSemanticInfo.doc = currentSemanticInfo.doc; setSemanticInfo(newSemanticInfo, emitSignalWhenFinished); - if (debug) - qDebug() << "SemanticInfoUpdater: re-using current semantic info - source.revision" - << source.revision; + qCDebug(log) << "re-using current semantic info, source revision:" << source.revision; return true; } @@ -185,8 +182,7 @@ SemanticInfoUpdater::~SemanticInfoUpdater() SemanticInfo SemanticInfoUpdater::update(const SemanticInfo::Source &source) { - if (debug) - qDebug() << "SemanticInfoUpdater: update() - synchronous"; + qCDebug(log) << "update() - synchronous"; d->m_future.cancel(); const bool emitSignalWhenFinished = false; @@ -200,8 +196,7 @@ SemanticInfo SemanticInfoUpdater::update(const SemanticInfo::Source &source) void SemanticInfoUpdater::updateDetached(const SemanticInfo::Source source) { - if (debug) - qDebug() << "SemanticInfoUpdater: updateDetached() - asynchronous"; + qCDebug(log) << "updateDetached() - asynchronous"; d->m_future.cancel(); const bool emitSignalWhenFinished = true; diff --git a/src/plugins/cpptools/cppsourceprocessor.cpp b/src/plugins/cpptools/cppsourceprocessor.cpp index 49b482da887..cd56dae3c91 100644 --- a/src/plugins/cpptools/cppsourceprocessor.cpp +++ b/src/plugins/cpptools/cppsourceprocessor.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include /*! @@ -61,6 +62,8 @@ using namespace CppTools::Internal; typedef Document::DiagnosticMessage Message; +static Q_LOGGING_CATEGORY(log, "qtc.cpptools.sourceprocessor") + namespace { inline QByteArray generateFingerPrint(const QList &definedMacros, const QByteArray &code) @@ -112,7 +115,6 @@ inline const Macro revision(const WorkingCopy &workingCopy, CppSourceProcessor::CppSourceProcessor(const Snapshot &snapshot, DocumentCallback documentFinished) : m_snapshot(snapshot), m_documentFinished(documentFinished), - m_dumpFileNameWhileParsing(false), m_preprocess(this, &m_env), m_revision(0), m_defaultCodec(Core::EditorManager::defaultTextCodec()) @@ -445,8 +447,7 @@ void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, In return; } - if (m_dumpFileNameWhileParsing) - qDebug() << "Parsing:" << absoluteFileName << "contents:" << contents.size() << "bytes"; + qCDebug(log) << "Parsing:" << absoluteFileName << "contents:" << contents.size() << "bytes"; Document::Ptr document = Document::create(absoluteFileName); document->setRevision(m_revision); diff --git a/src/plugins/cpptools/cppsourceprocessor.h b/src/plugins/cpptools/cppsourceprocessor.h index bddf7359f02..d1bf18e5f7c 100644 --- a/src/plugins/cpptools/cppsourceprocessor.h +++ b/src/plugins/cpptools/cppsourceprocessor.h @@ -65,9 +65,6 @@ public: CppSourceProcessor(const CPlusPlus::Snapshot &snapshot, DocumentCallback documentFinished); ~CppSourceProcessor(); - void setDumpFileNameWhileParsing(bool onoff) - { m_dumpFileNameWhileParsing = onoff; } - void setRevision(unsigned revision); void setWorkingCopy(const CppTools::WorkingCopy &workingCopy); void setHeaderPaths(const ProjectPart::HeaderPaths &headerPaths); @@ -117,7 +114,6 @@ private: CPlusPlus::Snapshot m_snapshot; CPlusPlus::Snapshot m_globalSnapshot; DocumentCallback m_documentFinished; - bool m_dumpFileNameWhileParsing; CPlusPlus::Environment m_env; CPlusPlus::Preprocessor m_preprocess; ProjectPart::HeaderPaths m_headerPaths; diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp index 8188dfbcb18..00750ed0d9c 100644 --- a/src/plugins/cpptools/cpptoolstestcase.cpp +++ b/src/plugins/cpptools/cpptoolstestcase.cpp @@ -195,7 +195,7 @@ bool TestCase::writeFile(const QString &filePath, const QByteArray &contents) FileWriterAndRemover::FileWriterAndRemover(const QString &filePath, const QByteArray &contents) : m_filePath(filePath) { - if (QFileInfo(filePath).exists()) { + if (QFileInfo::exists(filePath)) { const QString warning = QString::fromLatin1( "Will not overwrite existing file: \"%1\"." " If this file is left over due to a(n) abort/crash, please remove manually.") diff --git a/src/plugins/cpptools/semantichighlighter.cpp b/src/plugins/cpptools/semantichighlighter.cpp index 8e598963005..baf7940afe1 100644 --- a/src/plugins/cpptools/semantichighlighter.cpp +++ b/src/plugins/cpptools/semantichighlighter.cpp @@ -35,12 +35,14 @@ #include -enum { debug = 0 }; +#include using namespace CPlusPlus; using TextEditor::SemanticHighlighter::incrementalApplyExtraAdditionalFormats; using TextEditor::SemanticHighlighter::clearExtraAdditionalFormatsUntilEnd; +static Q_LOGGING_CATEGORY(log, "qtc.cpptools.semantichighlighter") + namespace CppTools { SemanticHighlighter::SemanticHighlighter(TextEditor::TextDocument *baseTextDocument) @@ -74,8 +76,7 @@ void SemanticHighlighter::run() { QTC_ASSERT(m_highlightingRunner, return); - if (debug) - qDebug() << "SemanticHighlighter: run()"; + qCDebug(log) << "SemanticHighlighter: run()"; if (m_watcher) { disconnectWatcher(); @@ -101,8 +102,7 @@ void SemanticHighlighter::onHighlighterResultAvailable(int from, int to) else if (!m_watcher || m_watcher->isCanceled()) return; // aborted - if (debug) - qDebug() << "SemanticHighlighter: onHighlighterResultAvailable()" << from << to; + qCDebug(log) << "onHighlighterResultAvailable()" << from << to; TextEditor::SyntaxHighlighter *highlighter = m_baseTextDocument->syntaxHighlighter(); QTC_ASSERT(highlighter, return); @@ -116,8 +116,7 @@ void SemanticHighlighter::onHighlighterFinished() TextEditor::SyntaxHighlighter *highlighter = m_baseTextDocument->syntaxHighlighter(); QTC_CHECK(highlighter); if (highlighter) { - if (debug) - qDebug() << "SemanticHighlighter: onHighlighterFinished() - clearing formats"; + qCDebug(log) << "onHighlighterFinished() - clearing formats"; clearExtraAdditionalFormatsUntilEnd(highlighter, m_watcher->future()); } } diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 238fd207909..b978f95af65 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -866,6 +866,9 @@ void DebuggerEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &re rc.replace(sepIndex + 1, rc.count() - sepIndex - 1, QString::number(result.gdbServerPort)); } + } else if (result.inferiorPid != InvalidPid && startParameters().startMode == AttachExternal) { + // e.g. iOS Simulator + startParameters().attachPID = result.inferiorPid; } if (result.qmlServerPort != InvalidPort) { diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index ca5dc9bd9a5..b8f1dd922f4 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -318,8 +318,7 @@ protected: virtual void notifyInferiorStopOk(); virtual void notifyInferiorSpontaneousStop(); virtual void notifyInferiorStopFailed(); -public: - virtual void notifyInferiorExited(); + Q_SLOT virtual void notifyInferiorExited(); protected: virtual void notifyInferiorShutdownOk(); diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp index 55916a397e2..52f75868c5b 100644 --- a/src/plugins/debugger/debuggeritemmanager.cpp +++ b/src/plugins/debugger/debuggeritemmanager.cpp @@ -298,7 +298,7 @@ void DebuggerItemManager::readLegacyDebuggers(const FileName &file) if (fn == QLatin1String("auto")) continue; FileName command = FileName::fromUserInput(fn); - if (!command.toFileInfo().exists()) + if (!command.exists()) continue; if (findByCommand(command)) continue; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 59c3fe7906b..979e4a00db8 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1417,7 +1417,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data) //qDebug() << "BP " << rid << data.toString(); // Quickly set the location marker. if (lineNumber && !boolSetting(OperateByInstruction) - && QFileInfo(fullName).exists() + && QFileInfo::exists(fullName) && !isQmlStepBreakpoint(rid) && !isQFatalBreakpoint(rid)) gotoLocation(Location(fullName, lineNumber)); diff --git a/src/plugins/debugger/gdb/startgdbserverdialog.cpp b/src/plugins/debugger/gdb/startgdbserverdialog.cpp index 835ad44f045..1147074722d 100644 --- a/src/plugins/debugger/gdb/startgdbserverdialog.cpp +++ b/src/plugins/debugger/gdb/startgdbserverdialog.cpp @@ -172,22 +172,22 @@ void GdbServerStarter::attach(int port) QString binary; QString localExecutable; QString candidate = sysroot + d->process.exe; - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) localExecutable = candidate; if (localExecutable.isEmpty()) { binary = d->process.cmdLine.section(QLatin1Char(' '), 0, 0); candidate = sysroot + QLatin1Char('/') + binary; - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) localExecutable = candidate; } if (localExecutable.isEmpty()) { candidate = sysroot + QLatin1String("/usr/bin/") + binary; - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) localExecutable = candidate; } if (localExecutable.isEmpty()) { candidate = sysroot + QLatin1String("/bin/") + binary; - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) localExecutable = candidate; } if (localExecutable.isEmpty()) { diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index d7e9ccddb63..8c2b432cba2 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -768,7 +768,7 @@ void PdbEngine::handleBacktrace(const PdbResponse &response) frame.line = lineNumber; frame.function = _(line.mid(pos2 + 1)); frame.usable = QFileInfo(frame.file).isReadable(); - if (frame.line > 0 && QFileInfo(frame.file).exists()) { + if (frame.line > 0 && QFileInfo::exists(frame.file)) { if (line.startsWith("> ")) currentIndex = level; frame.level = level; diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp index 09fbc0ae717..0719a91f41f 100644 --- a/src/plugins/designer/formwindowfile.cpp +++ b/src/plugins/designer/formwindowfile.cpp @@ -96,7 +96,7 @@ bool FormWindowFile::save(QString *errorString, const QString &name, bool autoSa m_formWindow->setDirty(false); setFilePath(fi.absoluteFilePath()); - emit changed(); + updateIsModified(); return true; } diff --git a/src/plugins/diffeditor/diffeditor.cpp b/src/plugins/diffeditor/diffeditor.cpp index 5dac850ce8e..0d4412c1acf 100644 --- a/src/plugins/diffeditor/diffeditor.cpp +++ b/src/plugins/diffeditor/diffeditor.cpp @@ -322,12 +322,12 @@ QWidget *DiffEditor::toolBar() whitespaceButton->setText(tr("Ignore Whitespace")); whitespaceButton->setCheckable(true); whitespaceButton->setChecked(m_controller->isIgnoreWhitespace()); - m_toolBar->addWidget(whitespaceButton); + m_whitespaceButtonAction = m_toolBar->addWidget(whitespaceButton); QLabel *contextLabel = new QLabel(m_toolBar); contextLabel->setText(tr("Context Lines:")); contextLabel->setContentsMargins(6, 0, 6, 0); - m_toolBar->addWidget(contextLabel); + m_contextLabelAction = m_toolBar->addWidget(contextLabel); QSpinBox *contextSpinBox = new QSpinBox(m_toolBar); contextSpinBox->setRange(1, 100); @@ -335,7 +335,7 @@ QWidget *DiffEditor::toolBar() contextSpinBox->setFrame(false); contextSpinBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); // Mac Qt5 - m_toolBar->addWidget(contextSpinBox); + m_contextSpinBoxAction = m_toolBar->addWidget(contextSpinBox); QToolButton *toggleDescription = new QToolButton(m_toolBar); toggleDescription->setIcon( @@ -497,6 +497,9 @@ void DiffEditor::slotDescriptionVisibilityChanged() void DiffEditor::slotReloaderChanged(DiffEditorReloader *reloader) { + m_whitespaceButtonAction->setVisible(reloader); + m_contextLabelAction->setVisible(reloader); + m_contextSpinBoxAction->setVisible(reloader); m_reloadAction->setVisible(reloader); } diff --git a/src/plugins/diffeditor/diffeditor.h b/src/plugins/diffeditor/diffeditor.h index c843fd33261..74ebb4bf1f8 100644 --- a/src/plugins/diffeditor/diffeditor.h +++ b/src/plugins/diffeditor/diffeditor.h @@ -104,6 +104,9 @@ private: DiffEditorGuiController *m_guiController; QToolBar *m_toolBar; QComboBox *m_entriesComboBox; + QAction *m_whitespaceButtonAction; + QAction *m_contextLabelAction; + QAction *m_contextSpinBoxAction; QAction *m_toggleDescriptionAction; QAction *m_reloadAction; QToolButton *m_diffEditorSwitcher; diff --git a/src/plugins/diffeditor/diffeditorcontroller.cpp b/src/plugins/diffeditor/diffeditorcontroller.cpp index 1a9e145fec4..5aeb8d27058 100644 --- a/src/plugins/diffeditor/diffeditorcontroller.cpp +++ b/src/plugins/diffeditor/diffeditorcontroller.cpp @@ -64,7 +64,7 @@ DiffEditorController::DiffEditorController(QObject *parent) DiffEditorController::~DiffEditorController() { - + delete m_reloader; } QString DiffEditorController::clearMessage() const @@ -137,20 +137,20 @@ DiffEditorReloader *DiffEditorController::reloader() const return m_reloader; } +// The ownership of reloader is passed to the controller void DiffEditorController::setReloader(DiffEditorReloader *reloader) { if (m_reloader == reloader) return; // nothing changes - if (m_reloader) - m_reloader->setController(0); + delete m_reloader; m_reloader = reloader; if (m_reloader) m_reloader->setController(this); - reloaderChanged(m_reloader); + emit reloaderChanged(m_reloader); } void DiffEditorController::clear() diff --git a/src/plugins/diffeditor/diffeditordocument.cpp b/src/plugins/diffeditor/diffeditordocument.cpp index 517717c92d9..db28ee601de 100644 --- a/src/plugins/diffeditor/diffeditordocument.cpp +++ b/src/plugins/diffeditor/diffeditordocument.cpp @@ -31,6 +31,8 @@ #include "diffeditordocument.h" #include "diffeditorconstants.h" #include "diffeditorcontroller.h" +#include "diffeditormanager.h" +#include "diffeditorreloader.h" #include "diffutils.h" #include @@ -83,6 +85,10 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo if (!ok) return false; + if (m_controller->reloader()) + m_controller->setReloader(0); + + DiffEditorManager::removeDocument(this); const QFileInfo fi(fileName); setTemporary(false); setFilePath(QDir::cleanPath(fi.absoluteFilePath())); @@ -105,10 +111,7 @@ bool DiffEditorDocument::open(QString *errorString, const QString &fileName) return false; bool ok = false; - QList fileDataList - = DiffUtils::readPatch(patch, - m_controller->isIgnoreWhitespace(), - &ok); + QList fileDataList = DiffUtils::readPatch(patch, &ok); if (!ok) { *errorString = tr("Could not parse patch file \"%1\". " "The content is not of unified diff format.") diff --git a/src/plugins/diffeditor/diffeditormanager.cpp b/src/plugins/diffeditor/diffeditormanager.cpp index ee883f93154..a8d306ad079 100644 --- a/src/plugins/diffeditor/diffeditormanager.cpp +++ b/src/plugins/diffeditor/diffeditormanager.cpp @@ -115,5 +115,14 @@ DiffEditorDocument *DiffEditorManager::findOrCreate(const QString &documentId, c return document; } +void DiffEditorManager::removeDocument(DiffEditorDocument *document) +{ + if (!instance()->documentToId.contains(document)) + return; + const QString documentId = instance()->documentToId.value(document); + instance()->documentToId.remove(document); + instance()->idToDocument.remove(documentId); +} + } // namespace DiffEditor diff --git a/src/plugins/diffeditor/diffeditormanager.h b/src/plugins/diffeditor/diffeditormanager.h index 9bc0d60e598..9a4be095818 100644 --- a/src/plugins/diffeditor/diffeditormanager.h +++ b/src/plugins/diffeditor/diffeditormanager.h @@ -53,6 +53,7 @@ public: static DiffEditorDocument *find(const QString &documentId); static DiffEditorDocument *findOrCreate(const QString &documentId, const QString &displayName); + static void removeDocument(DiffEditorDocument *document); private slots: void slotEditorsClosed(const QList &editors); diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index f8f2ce4183b..3c48515d105 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -54,8 +54,7 @@ class SimpleDiffEditorReloader : public DiffEditorReloader { Q_OBJECT public: - SimpleDiffEditorReloader(QObject *parent, - const QString &leftFileName, + SimpleDiffEditorReloader(const QString &leftFileName, const QString &rightFileName); protected: @@ -66,11 +65,9 @@ private: QString m_rightFileName; }; -SimpleDiffEditorReloader::SimpleDiffEditorReloader(QObject *parent, - const QString &leftFileName, +SimpleDiffEditorReloader::SimpleDiffEditorReloader(const QString &leftFileName, const QString &rightFileName) - : DiffEditorReloader(parent), - m_leftFileName(leftFileName), + : m_leftFileName(leftFileName), m_rightFileName(rightFileName) { } @@ -206,7 +203,7 @@ void DiffEditorPlugin::diff() DiffEditorController *controller = document->controller(); if (!controller->reloader()) { SimpleDiffEditorReloader *reloader = - new SimpleDiffEditorReloader(controller, fileName1, fileName2); + new SimpleDiffEditorReloader(fileName1, fileName2); controller->setReloader(reloader); } @@ -475,7 +472,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch() QCOMPARE(result, patchText); bool ok; - QList resultList = DiffUtils::readPatch(result, false, &ok); + QList resultList = DiffUtils::readPatch(result, &ok); QVERIFY(ok); QCOMPARE(resultList.count(), 1); @@ -871,6 +868,32 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data() QTest::newRow("Multiple renames") << patch << fileDataList6; + ////////////// + + // Dirty submodule + patch = _("diff --git a/src/shared/qbs b/src/shared/qbs\n" + "--- a/src/shared/qbs\n" + "+++ b/src/shared/qbs\n" + "@@ -1 +1 @@\n" + "-Subproject commit eda76354077a427d692fee05479910de31040d3f\n" + "+Subproject commit eda76354077a427d692fee05479910de31040d3f-dirty\n" + ); + fileData1 = FileData(); + fileData1.leftFileInfo = DiffFileInfo(_("src/shared/qbs")); + fileData1.rightFileInfo = DiffFileInfo(_("src/shared/qbs")); + chunkData1.leftStartingLineNumber = 0; + chunkData1.rightStartingLineNumber = 0; + rows1.clear(); + rows1 << RowData(_("Subproject commit eda76354077a427d692fee05479910de31040d3f"), + _("Subproject commit eda76354077a427d692fee05479910de31040d3f-dirty")); + chunkData1.rows = rows1; + fileData1.chunks.clear(); + fileData1.chunks << chunkData1; + + QList fileDataList7; + fileDataList7 << fileData1; + QTest::newRow("Dirty submodule") << patch + << fileDataList7; } void DiffEditor::Internal::DiffEditorPlugin::testReadPatch() @@ -879,7 +902,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch() QFETCH(QList, fileDataList); bool ok; - QList result = DiffUtils::readPatch(sourcePatch, false, &ok); + QList result = DiffUtils::readPatch(sourcePatch, &ok); QVERIFY(ok); QCOMPARE(fileDataList.count(), result.count()); diff --git a/src/plugins/diffeditor/diffeditorreloader.cpp b/src/plugins/diffeditor/diffeditorreloader.cpp index 78fd9bf8d1d..88bc93795a6 100644 --- a/src/plugins/diffeditor/diffeditorreloader.cpp +++ b/src/plugins/diffeditor/diffeditorreloader.cpp @@ -33,9 +33,8 @@ namespace DiffEditor { -DiffEditorReloader::DiffEditorReloader(QObject *parent) - : QObject(parent), - m_controller(0), +DiffEditorReloader::DiffEditorReloader() + : m_controller(0), m_reloading(false) { } diff --git a/src/plugins/diffeditor/diffeditorreloader.h b/src/plugins/diffeditor/diffeditorreloader.h index 918a213eeb0..11e593a214d 100644 --- a/src/plugins/diffeditor/diffeditorreloader.h +++ b/src/plugins/diffeditor/diffeditorreloader.h @@ -43,7 +43,7 @@ class DIFFEDITOR_EXPORT DiffEditorReloader : public QObject { Q_OBJECT public: - DiffEditorReloader(QObject *parent = 0); + DiffEditorReloader(); ~DiffEditorReloader(); bool isReloading() const; diff --git a/src/plugins/diffeditor/diffutils.cpp b/src/plugins/diffeditor/diffutils.cpp index b5ed3a62099..3f9c43a20de 100644 --- a/src/plugins/diffeditor/diffutils.cpp +++ b/src/plugins/diffeditor/diffutils.cpp @@ -517,7 +517,6 @@ QString DiffUtils::makePatch(const QList &fileDataList) } static QList readLines(const QString &patch, - bool ignoreWhitespace, bool lastChunk, bool *lastChunkAtTheEndOfFile, bool *ok) @@ -678,28 +677,16 @@ static QList readLines(const QString &patch, QList outputLeftDiffList; QList outputRightDiffList; - if (ignoreWhitespace) { - const QList leftIntermediate = - Differ::moveWhitespaceIntoEqualities(leftDiffList); - const QList rightIntermediate = - Differ::moveWhitespaceIntoEqualities(rightDiffList); - Differ::ignoreWhitespaceBetweenEqualities(leftIntermediate, - rightIntermediate, - &outputLeftDiffList, - &outputRightDiffList); - } else { - Differ::diffBetweenEqualities(leftDiffList, - rightDiffList, - &outputLeftDiffList, - &outputRightDiffList); - } + Differ::diffBetweenEqualities(leftDiffList, + rightDiffList, + &outputLeftDiffList, + &outputRightDiffList); return DiffUtils::calculateOriginalData(outputLeftDiffList, outputRightDiffList).rows; } static QList readChunks(const QString &patch, - bool ignoreWhitespace, bool *lastChunkAtTheEndOfFile, bool *ok) { @@ -728,7 +715,6 @@ static QList readChunks(const QString &patch, const QString lines = patch.mid(endOfLastChunk, pos - endOfLastChunk); chunkDataList.last().rows = readLines(lines, - ignoreWhitespace, false, lastChunkAtTheEndOfFile, &readOk); @@ -747,7 +733,6 @@ static QList readChunks(const QString &patch, if (endOfLastChunk > 0) { const QString lines = patch.mid(endOfLastChunk); chunkDataList.last().rows = readLines(lines, - ignoreWhitespace, true, lastChunkAtTheEndOfFile, &readOk); @@ -761,7 +746,6 @@ static QList readChunks(const QString &patch, } static FileData readDiffHeaderAndChunks(const QString &headerAndChunks, - bool ignoreWhitespace, bool *ok) { QString patch = headerAndChunks; @@ -789,7 +773,6 @@ static FileData readDiffHeaderAndChunks(const QString &headerAndChunks, fileData.rightFileInfo.fileName = rightFileRegExp.cap(1); fileData.chunks = readChunks(patch, - ignoreWhitespace, &fileData.lastChunkAtTheEndOfFile, &readOk); } @@ -811,7 +794,6 @@ static FileData readDiffHeaderAndChunks(const QString &headerAndChunks, } static QList readDiffPatch(const QString &patch, - bool ignoreWhitespace, bool *ok) { const QRegExp diffRegExp(QLatin1String("(?:\\n|^)" // new line of the beginning of a patch @@ -844,7 +826,6 @@ static QList readDiffPatch(const QString &patch, pos - lastPos); const FileData fileData = readDiffHeaderAndChunks(headerAndChunks, - ignoreWhitespace, &readOk); if (!readOk) @@ -861,7 +842,6 @@ static QList readDiffPatch(const QString &patch, patch.count() - lastPos - 1); const FileData fileData = readDiffHeaderAndChunks(headerAndChunks, - ignoreWhitespace, &readOk); if (readOk) @@ -880,7 +860,6 @@ static QList readDiffPatch(const QString &patch, static FileData readGitHeaderAndChunks(const QString &headerAndChunks, const QString &fileName, - bool ignoreWhitespace, bool *ok) { FileData fileData; @@ -918,39 +897,38 @@ static FileData readGitHeaderAndChunks(const QString &headerAndChunks, fileData.rightFileInfo.typeInfo = indexRegExp.cap(2); patch.remove(0, indexRegExp.matchedLength()); + } - const QRegExp leftFileRegExp(QLatin1String("^-{3} ") // "--- " - + leftFileName // "a/fileName" or "/dev/null" - + QLatin1String("(?:\\t[^\\n]*)*\\n")); // optionally followed by: \t anything \t anything ...) - const QRegExp rightFileRegExp(QLatin1String("^\\+{3} ") // "+++ " - + rightFileName // "b/fileName" or "/dev/null" - + QLatin1String("(?:\\t[^\\n]*)*\\n")); // optionally followed by: \t anything \t anything ...) - const QRegExp binaryRegExp(QLatin1String("^Binary files ") - + leftFileName - + QLatin1String(" and ") - + rightFileName - + QLatin1String(" differ$")); + const QRegExp leftFileRegExp(QLatin1String("^-{3} ") // "--- " + + leftFileName // "a/fileName" or "/dev/null" + + QLatin1String("(?:\\t[^\\n]*)*\\n")); // optionally followed by: \t anything \t anything ...) + const QRegExp rightFileRegExp(QLatin1String("^\\+{3} ") // "+++ " + + rightFileName // "b/fileName" or "/dev/null" + + QLatin1String("(?:\\t[^\\n]*)*\\n")); // optionally followed by: \t anything \t anything ...) + const QRegExp binaryRegExp(QLatin1String("^Binary files ") + + leftFileName + + QLatin1String(" and ") + + rightFileName + + QLatin1String(" differ$")); - // empty or followed either by leftFileRegExp or by binaryRegExp - if (patch.isEmpty() && (fileData.fileOperation == FileData::NewFile - || fileData.fileOperation == FileData::DeleteFile)) { - readOk = true; - } else if (leftFileRegExp.indexIn(patch) == 0) { - patch.remove(0, leftFileRegExp.matchedLength()); + // empty or followed either by leftFileRegExp or by binaryRegExp + if (patch.isEmpty() && (fileData.fileOperation == FileData::NewFile + || fileData.fileOperation == FileData::DeleteFile)) { + readOk = true; + } else if (leftFileRegExp.indexIn(patch) == 0) { + patch.remove(0, leftFileRegExp.matchedLength()); - // followed by rightFileRegExp - if (rightFileRegExp.indexIn(patch) == 0) { - patch.remove(0, rightFileRegExp.matchedLength()); + // followed by rightFileRegExp + if (rightFileRegExp.indexIn(patch) == 0) { + patch.remove(0, rightFileRegExp.matchedLength()); - fileData.chunks = readChunks(patch, - ignoreWhitespace, - &fileData.lastChunkAtTheEndOfFile, - &readOk); - } - } else if (binaryRegExp.indexIn(patch) == 0) { - readOk = true; - fileData.binaryFiles = true; + fileData.chunks = readChunks(patch, + &fileData.lastChunkAtTheEndOfFile, + &readOk); } + } else if (binaryRegExp.indexIn(patch) == 0) { + readOk = true; + fileData.binaryFiles = true; } if (ok) @@ -966,7 +944,6 @@ static FileData readCopyRenameChunks(const QString ©RenameChunks, FileData::FileOperation fileOperation, const QString &leftFileName, const QString &rightFileName, - bool ignoreWhitespace, bool *ok) { FileData fileData; @@ -1005,7 +982,6 @@ static FileData readCopyRenameChunks(const QString ©RenameChunks, patch.remove(0, rightFileRegExp.matchedLength()); fileData.chunks = readChunks(patch, - ignoreWhitespace, &fileData.lastChunkAtTheEndOfFile, &readOk); } @@ -1024,7 +1000,7 @@ static FileData readCopyRenameChunks(const QString ©RenameChunks, return fileData; } -static QList readGitPatch(const QString &patch, bool ignoreWhitespace, bool *ok) +static QList readGitPatch(const QString &patch, bool *ok) { const QRegExp simpleGitRegExp(QLatin1String("(?:\\n|^)diff --git a/([^\\n]+) b/\\1\\n")); // diff --git a/cap1 b/cap1 @@ -1074,14 +1050,12 @@ static QList readGitPatch(const QString &patch, bool ignoreWhitespace, if (lastOperation == FileData::ChangeFile) { fileData = readGitHeaderAndChunks(headerAndChunks, lastLeftFileName, - ignoreWhitespace, &readOk); } else { fileData = readCopyRenameChunks(headerAndChunks, lastOperation, lastLeftFileName, lastRightFileName, - ignoreWhitespace, &readOk); } if (!readOk) @@ -1124,14 +1098,12 @@ static QList readGitPatch(const QString &patch, bool ignoreWhitespace, fileData = readGitHeaderAndChunks(headerAndChunks, lastLeftFileName, - ignoreWhitespace, &readOk); } else { fileData = readCopyRenameChunks(headerAndChunks, lastOperation, lastLeftFileName, lastRightFileName, - ignoreWhitespace, &readOk); } if (readOk) @@ -1148,7 +1120,7 @@ static QList readGitPatch(const QString &patch, bool ignoreWhitespace, return fileDataList; } -QList DiffUtils::readPatch(const QString &patch, bool ignoreWhitespace, bool *ok) +QList DiffUtils::readPatch(const QString &patch, bool *ok) { bool readOk = false; @@ -1161,9 +1133,9 @@ QList DiffUtils::readPatch(const QString &patch, bool ignoreWhitespace if (pos != -1) croppedPatch = patch.left(pos + 1); // crop the ending for git format-patch - fileDataList = readGitPatch(croppedPatch, ignoreWhitespace, &readOk); + fileDataList = readGitPatch(croppedPatch, &readOk); if (!readOk) - fileDataList = readDiffPatch(croppedPatch, ignoreWhitespace, &readOk); + fileDataList = readDiffPatch(croppedPatch, &readOk); if (ok) *ok = readOk; diff --git a/src/plugins/diffeditor/diffutils.h b/src/plugins/diffeditor/diffutils.h index c1e3dd9e6ff..bb0d3ed0d48 100644 --- a/src/plugins/diffeditor/diffutils.h +++ b/src/plugins/diffeditor/diffutils.h @@ -148,7 +148,6 @@ public: bool lastChunk = false); static QString makePatch(const QList &fileDataList); static QList readPatch(const QString &patch, - bool ignoreWhitespace, bool *ok = 0); }; diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index b517e052fb6..81d225f91c7 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1125,6 +1125,9 @@ public: QString toString() const { + if (!m_text.isEmpty()) + return QString(m_text).replace(_("<"), _("")); + QString key = vimKeyNames().key(m_key); bool namedKey = !key.isEmpty(); @@ -6894,11 +6897,12 @@ QString FakeVimHandler::Private::selectText(const Range &range) const return tc.selection().toPlainText(); } if (range.rangemode == RangeLineMode) { + const QTextBlock firstBlock = document()->findBlock(range.beginPos); + int firstPos = firstBlock.isValid() ? firstBlock.position() : 0; + QTextBlock lastBlock = document()->findBlock(range.endPos); + bool endOfDoc = lastBlock == document()->lastBlock(); + int lastPos = endOfDoc ? lastPositionInDocument(true) : lastBlock.next().position(); QTextCursor tc(document()); - int firstPos = firstPositionInLine(lineForPosition(range.beginPos)); - int lastLine = lineForPosition(range.endPos); - bool endOfDoc = lastLine == lineNumber(document()->lastBlock()); - int lastPos = endOfDoc ? lastPositionInDocument(true) : firstPositionInLine(lastLine + 1); tc.setPosition(firstPos, MoveAnchor); tc.setPosition(lastPos, KeepAnchor); return tc.selection().toPlainText() + _(endOfDoc? "\n" : ""); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index e5ce9f2c23c..fcdfbf43ea4 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -331,8 +331,7 @@ void GitDiffHandler::slotTextualDiffOutputReceived(const QString &contents) bool ok; QList fileDataList - = DiffEditor::DiffUtils::readPatch( - contents, m_controller->isIgnoreWhitespace(), &ok); + = DiffEditor::DiffUtils::readPatch(contents, &ok); m_controller->setDiffFiles(fileDataList, m_workingDirectory); m_controller->requestRestoreState(); deleteLater(); @@ -368,7 +367,7 @@ public: DiffShow }; - GitDiffEditorReloader(QObject *parent); + GitDiffEditorReloader(); void setWorkingDirectory(const QString &workingDir) { m_workingDirectory = workingDir; } @@ -408,9 +407,8 @@ private: QString m_displayName; }; -GitDiffEditorReloader::GitDiffEditorReloader(QObject *parent) - : DiffEditorReloader(parent), - m_gitClient(GitPlugin::instance()->gitClient()) +GitDiffEditorReloader::GitDiffEditorReloader() + : m_gitClient(GitPlugin::instance()->gitClient()) { } @@ -831,7 +829,7 @@ GitDiffEditorReloader *GitClient::findOrCreateDiffEditor(const QString &document connect(controller, SIGNAL(expandBranchesRequested(QString)), this, SLOT(branchesForCommit(QString))); - reloader = new GitDiffEditorReloader(controller); + reloader = new GitDiffEditorReloader(); controller->setReloader(reloader); reloader->setWorkingDirectory(workingDirectory); @@ -3225,8 +3223,8 @@ bool GitClient::synchronousMerge(const QString &workingDirectory, const QString bool GitClient::canRebase(const QString &workingDirectory) const { const QString gitDir = findGitDirForRepository(workingDirectory); - if (QFileInfo(gitDir + QLatin1String("/rebase-apply")).exists() - || QFileInfo(gitDir + QLatin1String("/rebase-merge")).exists()) { + if (QFileInfo::exists(gitDir + QLatin1String("/rebase-apply")) + || QFileInfo::exists(gitDir + QLatin1String("/rebase-merge"))) { VcsOutputWindow::appendError( tr("Rebase, merge or am is in progress. Finish " "or abort it and then try again.")); diff --git a/src/plugins/glsleditor/GLSLEditor.json.in b/src/plugins/glsleditor/GLSLEditor.json.in index 62014949d26..d631fba6e2a 100644 --- a/src/plugins/glsleditor/GLSLEditor.json.in +++ b/src/plugins/glsleditor/GLSLEditor.json.in @@ -12,7 +12,7 @@ \"\", \"Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\" ], - \"Category\" : \"GLSL\", + \"Category\" : \"Other Languages\", \"Description\" : \"Editor for GLSL.\", \"Url\" : \"http://www.qt-project.org\", $$dependencyList diff --git a/src/plugins/help/helpwidget.cpp b/src/plugins/help/helpwidget.cpp index dfe6790233c..a0b87e39c21 100644 --- a/src/plugins/help/helpwidget.cpp +++ b/src/plugins/help/helpwidget.cpp @@ -432,7 +432,7 @@ int HelpWidget::currentIndex() const return m_viewerStack->currentIndex(); } -void HelpWidget::addViewer(HelpViewer *viewer, bool highlightSearchTerms) +void HelpWidget::addViewer(HelpViewer *viewer) { m_viewerStack->addWidget(viewer); viewer->setFocus(Qt::OtherFocusReason); @@ -456,8 +456,7 @@ void HelpWidget::addViewer(HelpViewer *viewer, bool highlightSearchTerms) if (m_style == ExternalWindow) connect(viewer, SIGNAL(titleChanged()), this, SLOT(updateWindowTitle())); - if (highlightSearchTerms) - connect(viewer, &HelpViewer::loadFinished, this, &HelpWidget::highlightSearchTerms); + connect(viewer, &HelpViewer::loadFinished, this, &HelpWidget::highlightSearchTerms); updateCloseButton(); } @@ -523,14 +522,14 @@ void HelpWidget::setSource(const QUrl &url) viewer->setFocus(Qt::OtherFocusReason); } -void HelpWidget::openFromSearch(const QUrl &url, bool newPage) +void HelpWidget::openFromSearch(const QUrl &url, const QStringList &searchTerms, bool newPage) { + m_searchTerms = searchTerms; if (newPage) - OpenPagesManager::instance().createPageFromSearch(url); + OpenPagesManager::instance().createPage(url); else { HelpViewer* viewer = currentViewer(); QTC_ASSERT(viewer, return); - connect(viewer, &HelpViewer::loadFinished, this, &HelpWidget::highlightSearchTerms); viewer->setSource(url); viewer->setFocus(Qt::OtherFocusReason); } @@ -655,29 +654,13 @@ void HelpWidget::print(HelpViewer *viewer) void HelpWidget::highlightSearchTerms() { - if (HelpViewer *viewer = qobject_cast(sender())) { - QHelpSearchEngine *searchEngine = - LocalHelpManager::helpEngine().searchEngine(); - QList queryList = searchEngine->query(); - - QStringList terms; - foreach (const QHelpSearchQuery &query, queryList) { - switch (query.fieldName) { - default: break; - case QHelpSearchQuery::ALL: { - case QHelpSearchQuery::PHRASE: - case QHelpSearchQuery::DEFAULT: - case QHelpSearchQuery::ATLEAST: - foreach (QString term, query.wordList) - terms.append(term.remove(QLatin1Char('"'))); - } - } - } - - foreach (const QString& term, terms) - viewer->findText(term, 0, false, true); - disconnect(viewer, &HelpViewer::loadFinished, this, &HelpWidget::highlightSearchTerms); - } + if (m_searchTerms.isEmpty()) + return; + HelpViewer *viewer = qobject_cast(sender()); + QTC_ASSERT(viewer, return); + foreach (const QString& term, m_searchTerms) + viewer->findText(term, 0, false, true); + m_searchTerms.clear(); } } // Internal diff --git a/src/plugins/help/helpwidget.h b/src/plugins/help/helpwidget.h index daafb849ab6..addb95dc80f 100644 --- a/src/plugins/help/helpwidget.h +++ b/src/plugins/help/helpwidget.h @@ -71,7 +71,7 @@ public: HelpViewer *currentViewer() const; void setCurrentViewer(HelpViewer *viewer); int currentIndex() const; - void addViewer(HelpViewer *viewer, bool highlightSearchTerms = false); + void addViewer(HelpViewer *viewer); void removeViewerAt(int index); void setViewerFont(const QFont &font); @@ -81,7 +81,7 @@ public: HelpViewer *viewerAt(int index) const; void open(const QUrl &url, bool newPage = false); - void openFromSearch(const QUrl &url, bool newPage = false); + void openFromSearch(const QUrl &url, const QStringList &searchTerms, bool newPage = false); void showTopicChooser(const QMap &links, const QString &key, bool newPage = false); void activateSideBarItem(const QString &id); @@ -148,6 +148,8 @@ private: QAction *m_bookmarkAction; QAction *m_searchAction; QAction *m_openPagesAction; + + QStringList m_searchTerms; }; } // Internal diff --git a/src/plugins/help/openpagesmanager.cpp b/src/plugins/help/openpagesmanager.cpp index 1d4f98aa885..751f78bb1e4 100644 --- a/src/plugins/help/openpagesmanager.cpp +++ b/src/plugins/help/openpagesmanager.cpp @@ -187,12 +187,7 @@ HelpViewer *OpenPagesManager::createPage() return createPage(QUrl(Help::Constants::AboutBlank)); } -HelpViewer *OpenPagesManager::createPageFromSearch(const QUrl &url) -{ - return createPage(url, true); -} - -HelpViewer *OpenPagesManager::createPage(const QUrl &url, bool fromSearch) +HelpViewer *OpenPagesManager::createPage(const QUrl &url) { if (url.isValid() && HelpViewer::launchWithExternalApp(url)) return 0; @@ -201,7 +196,7 @@ HelpViewer *OpenPagesManager::createPage(const QUrl &url, bool fromSearch) const int index = m_model->rowCount() - 1; HelpViewer * const page = m_model->pageAt(index); - CentralWidget::instance()->addViewer(page, fromSearch); + CentralWidget::instance()->addViewer(page); emit pagesChanged(); setCurrentPage(index); diff --git a/src/plugins/help/openpagesmanager.h b/src/plugins/help/openpagesmanager.h index b5f0eb56a46..2e8d481bd8a 100644 --- a/src/plugins/help/openpagesmanager.h +++ b/src/plugins/help/openpagesmanager.h @@ -66,8 +66,7 @@ public: public slots: HelpViewer *createPage(); - HelpViewer *createPageFromSearch(const QUrl &url); - HelpViewer *createPage(const QUrl &url, bool fromSearch = false); + HelpViewer *createPage(const QUrl &url); void setCurrentPage(int index); void setCurrentPage(const QModelIndex &index); diff --git a/src/plugins/help/qtwebkithelpviewer.cpp b/src/plugins/help/qtwebkithelpviewer.cpp index fc19702944e..3ae31b5715d 100644 --- a/src/plugins/help/qtwebkithelpviewer.cpp +++ b/src/plugins/help/qtwebkithelpviewer.cpp @@ -402,6 +402,10 @@ QtWebKitHelpViewer::QtWebKitHelpViewer(qreal zoom, QWidget *parent) layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_webView, 10); + QPalette p = palette(); + p.setColor(QPalette::Base, Qt::white); + setPalette(p); + connect(m_webView, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); connect(m_webView, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted())); connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished())); diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp index 706d1138489..a0e428e0aaf 100644 --- a/src/plugins/help/searchwidget.cpp +++ b/src/plugins/help/searchwidget.cpp @@ -137,7 +137,7 @@ void SearchWidget::showEvent(QShowEvent *event) connect(queryWidget, SIGNAL(search()), this, SLOT(search())); connect(resultWidget, &QHelpSearchResultWidget::requestShowLink, this, [this](const QUrl &url) { - emit linkActivated(url, false/*newPage*/); + emit linkActivated(url, currentSearchTerms(), false/*newPage*/); }); connect(searchEngine, SIGNAL(searchingStarted()), this, @@ -232,7 +232,7 @@ bool SearchWidget::eventFilter(QObject *o, QEvent *e) bool controlPressed = me->modifiers() & Qt::ControlModifier; if ((me->button() == Qt::LeftButton && controlPressed) || (me->button() == Qt::MidButton)) { - emit linkActivated(link, true/*newPage*/); + emit linkActivated(link, currentSearchTerms(), true/*newPage*/); } } } @@ -269,20 +269,43 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent) QAction *usedAction = menu.exec(mapToGlobal(contextMenuEvent->pos())); if (usedAction == openLink) - emit linkActivated(link, false/*newPage*/); + emit linkActivated(link, currentSearchTerms(), false/*newPage*/); else if (usedAction == openLinkInNewTab) - emit linkActivated(link, true/*newPage*/); + emit linkActivated(link, currentSearchTerms(), true/*newPage*/); else if (usedAction == copyAnchorAction) QApplication::clipboard()->setText(link.toString()); } +QStringList SearchWidget::currentSearchTerms() const +{ + QList queryList = searchEngine->query(); + + QStringList terms; + foreach (const QHelpSearchQuery &query, queryList) { + switch (query.fieldName) { + case QHelpSearchQuery::ALL: + case QHelpSearchQuery::PHRASE: + case QHelpSearchQuery::DEFAULT: + case QHelpSearchQuery::ATLEAST: { + foreach (QString term, query.wordList) + terms.append(term.remove(QLatin1Char('"'))); + } + break; + default: + break; + } + } + return terms; +} + // #pragma mark -- SearchSideBarItem SearchSideBarItem::SearchSideBarItem() : SideBarItem(new SearchWidget, QLatin1String(Constants::HELP_SEARCH)) { widget()->setWindowTitle(tr(Constants::SB_SEARCH)); - connect(widget(), SIGNAL(linkActivated(QUrl,bool)), this, SIGNAL(linkActivated(QUrl,bool))); + connect(widget(), SIGNAL(linkActivated(QUrl,QStringList,bool)), + this, SIGNAL(linkActivated(QUrl,QStringList,bool))); } QList SearchSideBarItem::createToolBarWidgets() diff --git a/src/plugins/help/searchwidget.h b/src/plugins/help/searchwidget.h index 58cc403687b..802efc957af 100644 --- a/src/plugins/help/searchwidget.h +++ b/src/plugins/help/searchwidget.h @@ -57,7 +57,7 @@ public: QList createToolBarWidgets(); signals: - void linkActivated(const QUrl &url, bool newPage); + void linkActivated(const QUrl &url, const QStringList &searchTerms, bool newPage); }; class SearchWidget : public QWidget @@ -77,7 +77,7 @@ public slots: void reindexDocumentation(); signals: - void linkActivated(const QUrl &link, bool newPage); + void linkActivated(const QUrl &link, const QStringList &searchTerms, bool newPage); protected: void showEvent(QShowEvent *event); @@ -94,6 +94,7 @@ private slots: private: bool eventFilter(QObject* o, QEvent *e); void contextMenuEvent(QContextMenuEvent *contextMenuEvent); + QStringList currentSearchTerms() const; private: int zoomCount; diff --git a/src/plugins/help/textbrowserhelpviewer.cpp b/src/plugins/help/textbrowserhelpviewer.cpp index 490702a9933..281efd9aa49 100644 --- a/src/plugins/help/textbrowserhelpviewer.cpp +++ b/src/plugins/help/textbrowserhelpviewer.cpp @@ -63,6 +63,7 @@ TextBrowserHelpViewer::TextBrowserHelpViewer(qreal zoom, QWidget *parent) p.color(QPalette::Active, QPalette::Highlight)); p.setColor(QPalette::Inactive, QPalette::HighlightedText, p.color(QPalette::Active, QPalette::HighlightedText)); + p.setColor(QPalette::Base, Qt::white); setPalette(p); connect(m_textBrowser, SIGNAL(sourceChanged(QUrl)), this, SIGNAL(titleChanged())); diff --git a/src/plugins/ios/iosdebugsupport.cpp b/src/plugins/ios/iosdebugsupport.cpp index 37e1a735622..98fbdeeca57 100644 --- a/src/plugins/ios/iosdebugsupport.cpp +++ b/src/plugins/ios/iosdebugsupport.cpp @@ -136,7 +136,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi Utils::FileName xcodeInfo = IosConfigurations::developerPath().parentDir() .appendPath(QLatin1String("Info.plist")); bool buggyLldb = false; - if (xcodeInfo.toFileInfo().exists()) { + if (xcodeInfo.exists()) { QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat); QStringList version = settings.value(QLatin1String("CFBundleShortVersionString")).toString() .split(QLatin1Char('.')); @@ -147,7 +147,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi bundlePath.chop(4); Utils::FileName dsymPath = Utils::FileName::fromString( bundlePath.append(QLatin1String(".dSYM"))); - if (!dsymPath.toFileInfo().exists()) { + if (!dsymPath.exists()) { if (buggyLldb) TaskHub::addTask(Task::Warning, tr("Debugging with Xcode 5.0.x can be unreliable without a dSYM. " diff --git a/src/plugins/ios/iosdeploystep.cpp b/src/plugins/ios/iosdeploystep.cpp index 7afe5dafcd9..78861b08627 100644 --- a/src/plugins/ios/iosdeploystep.cpp +++ b/src/plugins/ios/iosdeploystep.cpp @@ -272,7 +272,7 @@ void IosDeployStep::checkProvisioningProfile() // the file is a signed plist stored in DER format // we simply search for start and end of the plist instead of decoding the DER payload - if (!provisioningFilePath.toFileInfo().exists()) + if (!provisioningFilePath.exists()) return; QFile provisionFile(provisioningFilePath.toString()); if (!provisionFile.open(QIODevice::ReadOnly)) diff --git a/src/plugins/ios/iosdsymbuildstep.cpp b/src/plugins/ios/iosdsymbuildstep.cpp index 718a9f4a1c6..393076540ab 100644 --- a/src/plugins/ios/iosdsymbuildstep.cpp +++ b/src/plugins/ios/iosdsymbuildstep.cpp @@ -450,7 +450,7 @@ QStringList IosDsymBuildStep::defaultCmdList() const QString dsymutilCmd = QLatin1String("dsymutil"); Utils::FileName dsymUtilPath = IosConfigurations::developerPath() .appendPath(QLatin1String("Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil")); - if (dsymUtilPath.toFileInfo().exists()) + if (dsymUtilPath.exists()) dsymutilCmd = dsymUtilPath.toUserOutput(); IosRunConfiguration *runConf = qobject_cast(target()->activeRunConfiguration()); diff --git a/src/plugins/ios/iosrunner.cpp b/src/plugins/ios/iosrunner.cpp index d3f70b6ebe7..de7f2119660 100644 --- a/src/plugins/ios/iosrunner.cpp +++ b/src/plugins/ios/iosrunner.cpp @@ -117,7 +117,7 @@ void IosRunner::start() } m_cleanExit = false; m_qmlPort = 0; - if (!QFileInfo(m_bundleDir).exists()) { + if (!QFileInfo::exists(m_bundleDir)) { TaskHub::addTask(Task::Warning, tr("Could not find %1.").arg(m_bundleDir), ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT); diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp index e64181079d3..61617bc5a85 100644 --- a/src/plugins/ios/iostoolhandler.cpp +++ b/src/plugins/ios/iostoolhandler.cpp @@ -738,7 +738,7 @@ QString IosToolHandler::iosSimulatorToolPath() Utils::FileName devPath = Internal::IosConfigurations::developerPath(); bool version182 = devPath.appendPath(QLatin1String( "Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework")) - .toFileInfo().exists(); + .exists(); QString res = Core::ICore::libexecPath() + QLatin1String("/ios/iossim"); if (version182) res = res.append(QLatin1String("_1_8_2")); diff --git a/src/plugins/macros/actionmacrohandler.cpp b/src/plugins/macros/actionmacrohandler.cpp index 8c3c0f194d2..a6bbde5cc9d 100644 --- a/src/plugins/macros/actionmacrohandler.cpp +++ b/src/plugins/macros/actionmacrohandler.cpp @@ -59,8 +59,8 @@ ActionMacroHandler::ActionMacroHandler(): connect(m_mapper, SIGNAL(mapped(QString)), this, SLOT(addActionEvent(QString))); - connect(ActionManager::instance(), SIGNAL(commandAdded(QString)), - this, SLOT(addCommand(QString))); + connect(ActionManager::instance(), &ActionManager::commandAdded, + this, &ActionMacroHandler::addCommand); // Register all existing scriptable actions QList commands = ActionManager::commands(); @@ -113,9 +113,8 @@ void ActionMacroHandler::registerCommand(Id id) } } -void ActionMacroHandler::addCommand(const QString &name) +void ActionMacroHandler::addCommand(Id id) { - const Id id = Id::fromString(name); const Command *command = ActionManager::command(id); if (command->isScriptable()) registerCommand(id); diff --git a/src/plugins/macros/actionmacrohandler.h b/src/plugins/macros/actionmacrohandler.h index 4e83525a90e..7af20c3dc00 100644 --- a/src/plugins/macros/actionmacrohandler.h +++ b/src/plugins/macros/actionmacrohandler.h @@ -55,13 +55,13 @@ public: bool canExecuteEvent(const MacroEvent ¯oEvent); bool executeEvent(const MacroEvent ¯oEvent); +private slots: + void addActionEvent(const QString &id); + private: void registerCommand(Core::Id id); Core::Command *command(const QString &id); - -private slots: - void addCommand(const QString &id); - void addActionEvent(const QString &id); + void addCommand(Core::Id id); private: QSet m_commandIds; diff --git a/src/plugins/macros/macroevent.cpp b/src/plugins/macros/macroevent.cpp index 0d33e57f8f7..029ddc95450 100644 --- a/src/plugins/macros/macroevent.cpp +++ b/src/plugins/macros/macroevent.cpp @@ -34,7 +34,8 @@ #include #include -using namespace Macros::Internal; +namespace Macros { +namespace Internal { /*! \class Macros::MacroEvent @@ -50,57 +51,21 @@ using namespace Macros::Internal; The information are stored in a map of QVariants (using quint8 for keys). */ -class MacroEvent::MacroEventPrivate -{ -public: - Core::Id id; - QMap values; -}; - - -// ---------- MacroEvent ------------ - -MacroEvent::MacroEvent(): - d(new MacroEventPrivate) -{ -} - -MacroEvent::MacroEvent(const MacroEvent &other): - d(new MacroEventPrivate) -{ - d->id = other.d->id; - d->values = other.d->values; -} - -MacroEvent::~MacroEvent() -{ - delete d; -} - -MacroEvent& MacroEvent::operator=(const MacroEvent &other) -{ - if (this == &other) - return *this; - d->id = other.d->id; - d->values = other.d->values; - return *this; -} - QVariant MacroEvent::value(quint8 id) const { - return d->values.value(id); + return m_values.value(id); } void MacroEvent::setValue(quint8 id, const QVariant &value) { - d->values[id] = value; + m_values[id] = value; } void MacroEvent::load(QDataStream &stream) { QByteArray ba; stream >> ba; - d->id = Core::Id::fromName(ba); + m_id = Core::Id::fromName(ba); int count; stream >> count; quint8 id; @@ -108,15 +73,15 @@ void MacroEvent::load(QDataStream &stream) for (int i = 0; i < count; ++i) { stream >> id; stream >> value; - d->values[id] = value; + m_values[id] = value; } } void MacroEvent::save(QDataStream &stream) const { - stream << d->id.name(); - stream << d->values.count(); - QMapIterator i(d->values); + stream << m_id.name(); + stream << m_values.count(); + QMapIterator i(m_values); while (i.hasNext()) { i.next(); stream << i.key() << i.value(); @@ -125,10 +90,13 @@ void MacroEvent::save(QDataStream &stream) const Core::Id MacroEvent::id() const { - return d->id; + return m_id; } void MacroEvent::setId(Core::Id id) { - d->id = id; + m_id = id; } + +} // namespace Internal +} // namespace Macro diff --git a/src/plugins/macros/macroevent.h b/src/plugins/macros/macroevent.h index b2ca01d2f35..fc5ef38cc68 100644 --- a/src/plugins/macros/macroevent.h +++ b/src/plugins/macros/macroevent.h @@ -47,10 +47,7 @@ namespace Internal { class MacroEvent { public: - MacroEvent(); - MacroEvent(const MacroEvent &other); - virtual ~MacroEvent(); - MacroEvent& operator=(const MacroEvent &other); + MacroEvent() {} Core::Id id() const; void setId(Core::Id id); @@ -62,8 +59,8 @@ public: void save(QDataStream &stream) const; private: - class MacroEventPrivate; - MacroEventPrivate* d; + Core::Id m_id; + QMap m_values; }; } // namespace Internal diff --git a/src/plugins/mercurial/annotationhighlighter.cpp b/src/plugins/mercurial/annotationhighlighter.cpp index 90652cc77b2..bcf1f60c883 100644 --- a/src/plugins/mercurial/annotationhighlighter.cpp +++ b/src/plugins/mercurial/annotationhighlighter.cpp @@ -31,8 +31,8 @@ #include "annotationhighlighter.h" #include "constants.h" -using namespace Mercurial::Internal; -using namespace Mercurial; +namespace Mercurial { +namespace Internal { MercurialAnnotationHighlighter::MercurialAnnotationHighlighter(const ChangeNumbers &changeNumbers, QTextDocument *document) @@ -47,3 +47,6 @@ QString MercurialAnnotationHighlighter::changeNumber(const QString &block) const return changeset.cap(1); return QString(); } + +} // namespace Internal +} // namespace Mercurial diff --git a/src/plugins/mercurial/authenticationdialog.cpp b/src/plugins/mercurial/authenticationdialog.cpp index 38d5830c178..680d0fc0c48 100644 --- a/src/plugins/mercurial/authenticationdialog.cpp +++ b/src/plugins/mercurial/authenticationdialog.cpp @@ -31,7 +31,8 @@ #include "authenticationdialog.h" #include "ui_authenticationdialog.h" -using namespace Mercurial::Internal; +namespace Mercurial { +namespace Internal { AuthenticationDialog::AuthenticationDialog(const QString &username, const QString &password, QWidget *parent) : QDialog(parent), @@ -61,3 +62,6 @@ QString AuthenticationDialog::getPassword() { return ui->password->text(); } + +} // namespace Internal +} // namespace Mercurial diff --git a/src/plugins/mercurial/clonewizardpage.cpp b/src/plugins/mercurial/clonewizardpage.cpp index b214e654503..0e351f969b6 100644 --- a/src/plugins/mercurial/clonewizardpage.cpp +++ b/src/plugins/mercurial/clonewizardpage.cpp @@ -30,7 +30,8 @@ #include "clonewizardpage.h" -using namespace Mercurial::Internal; +namespace Mercurial { +namespace Internal { CloneWizardPage::CloneWizardPage(QWidget *parent) : VcsBase::BaseCheckoutWizardPage(parent) @@ -53,3 +54,6 @@ QString CloneWizardPage::directoryFromRepository(const QString &repository) cons // Take the basename or the repository url. return repo.mid(repo.lastIndexOf(slash) + 1); } + +} // namespace Internal +} // namespace Mercurial diff --git a/src/plugins/mercurial/commiteditor.cpp b/src/plugins/mercurial/commiteditor.cpp index 0f15bed33c1..ec722b4b31b 100644 --- a/src/plugins/mercurial/commiteditor.cpp +++ b/src/plugins/mercurial/commiteditor.cpp @@ -35,11 +35,12 @@ #include #include -#include //TODO REMOVE WHEN BASE FILE CHANGES ARE PULLED -using namespace Mercurial::Internal; using namespace VcsBase; +namespace Mercurial { +namespace Internal { + CommitEditor::CommitEditor(const VcsBaseSubmitEditorParameters *parameters) : VcsBaseSubmitEditor(parameters, new MercurialCommitWidget), fileModel(0) @@ -64,7 +65,6 @@ void CommitEditor::setFields(const QFileInfo &repositoryRoot, const QString &bra fileModel = new SubmitFileModel(this); - //TODO Messy tidy this up QStringList shouldTrack; foreach (const VcsBaseClient::StatusItem &item, repoStatus) { @@ -96,3 +96,6 @@ QString CommitEditor::repoRoot() { return commitWidget()->repoRoot(); } + +} // namespace Internal +} // namespace Mercurial diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp index 0101fc561b9..0886bdb2e08 100644 --- a/src/plugins/mercurial/mercurialclient.cpp +++ b/src/plugins/mercurial/mercurialclient.cpp @@ -352,7 +352,8 @@ void MercurialClient::view(const QString &source, const QString &id, const QStringList &extraOptions) { QStringList args; - args << QLatin1String("log") << QLatin1String("-p") << QLatin1String("-g"); + args << QLatin1String("-v") << QLatin1String("log") + << QLatin1String("-p") << QLatin1String("-g"); VcsBaseClient::view(source, id, args << extraOptions); } diff --git a/src/plugins/mercurial/mercurialcommitwidget.cpp b/src/plugins/mercurial/mercurialcommitwidget.cpp index 729785b7aba..28667434d90 100644 --- a/src/plugins/mercurial/mercurialcommitwidget.cpp +++ b/src/plugins/mercurial/mercurialcommitwidget.cpp @@ -32,75 +32,78 @@ #include #include +#include #include #include +#include #include #include -#include -#include - //see the git submit widget for details of the syntax Highlighter -//TODO Check to see when the Highlighter has been moved to a base class and use that instead - namespace Mercurial { namespace Internal { -// Retrieve the comment char format from the text editor. -static QTextCharFormat commentFormat() -{ - return TextEditor::TextEditorSettings::fontSettings().toTextCharFormat(TextEditor::C_COMMENT); -} - // Highlighter for Mercurial submit messages. Make the first line bold, indicates // comments as such (retrieving the format from the text editor) and marks up // keywords (words in front of a colon as in 'Task: '). -class MercurialSubmitHighlighter : QSyntaxHighlighter +class MercurialSubmitHighlighter : TextEditor::SyntaxHighlighter { public: explicit MercurialSubmitHighlighter(QTextEdit *parent); void highlightBlock(const QString &text); private: - enum State { Header, Comment, Other }; - const QTextCharFormat m_commentFormat; + enum State { None = -1, Header, Other }; + enum Format { Format_Comment }; QRegExp m_keywordPattern; - const QChar m_hashChar; }; MercurialSubmitHighlighter::MercurialSubmitHighlighter(QTextEdit *parent) : - QSyntaxHighlighter(parent), - m_commentFormat(commentFormat()), - m_keywordPattern(QLatin1String("^\\w+:")), - m_hashChar(QLatin1Char('#')) + TextEditor::SyntaxHighlighter(parent), + m_keywordPattern(QLatin1String("^\\w+:")) { + static QVector categories; + if (categories.isEmpty()) + categories << TextEditor::C_COMMENT; + + setTextFormatCategories(categories); QTC_CHECK(m_keywordPattern.isValid()); } void MercurialSubmitHighlighter::highlightBlock(const QString &text) { // figure out current state - State state = Other; - const QTextBlock block = currentBlock(); - if (block.position() == 0) { - state = Header; - } else { - if (text.startsWith(m_hashChar)) - state = Comment; + State state = static_cast(previousBlockState()); + if (text.startsWith(QLatin1String("HG:"))) { + setFormat(0, text.size(), formatForCategory(Format_Comment)); + setCurrentBlockState(state); + return; } + + if (state == None) { + if (text.isEmpty()) { + setCurrentBlockState(state); + return; + } + state = Header; + } else if (state == Header) { + state = Other; + } + + setCurrentBlockState(state); + // Apply format. switch (state) { + case None: + break; case Header: { - QTextCharFormat charFormat = format(0); - charFormat.setFontWeight(QFont::Bold); - setFormat(0, text.size(), charFormat); - } - break; - case Comment: - setFormat(0, text.size(), m_commentFormat); + QTextCharFormat charFormat = format(0); + charFormat.setFontWeight(QFont::Bold); + setFormat(0, text.size(), charFormat); break; + } case Other: // Format key words ("Task:") italic if (m_keywordPattern.indexIn(text, 0, QRegExp::CaretAtZero) == 0) { @@ -151,5 +154,14 @@ QString MercurialCommitWidget::repoRoot() return mercurialCommitPanelUi.repositoryLabel->text(); } +QString MercurialCommitWidget::cleanupDescription(const QString &input) const +{ + const QRegularExpression commentLine(QLatin1String("^HG:[^\\n]*(\\n|$)"), + QRegularExpression::MultilineOption); + QString message = input; + message.remove(commentLine); + return message; +} + } // namespace Internal } // namespace Mercurial diff --git a/src/plugins/mercurial/mercurialcommitwidget.h b/src/plugins/mercurial/mercurialcommitwidget.h index 41ece65600b..d042f4f4ab0 100644 --- a/src/plugins/mercurial/mercurialcommitwidget.h +++ b/src/plugins/mercurial/mercurialcommitwidget.h @@ -53,6 +53,9 @@ public: QString committer(); QString repoRoot(); +protected: + QString cleanupDescription(const QString &input) const; + private: QWidget *mercurialCommitPanel; Ui::MercurialCommitPanel mercurialCommitPanelUi; diff --git a/src/plugins/mercurial/mercurialcontrol.cpp b/src/plugins/mercurial/mercurialcontrol.cpp index 3bcb65ebd92..e1d2c2438a8 100644 --- a/src/plugins/mercurial/mercurialcontrol.cpp +++ b/src/plugins/mercurial/mercurialcontrol.cpp @@ -41,7 +41,8 @@ #include #include -using namespace Mercurial::Internal; +namespace Mercurial { +namespace Internal { class MercurialTopicCache : public Core::IVersionControl::TopicCache { @@ -199,3 +200,6 @@ void MercurialControl::emitConfigurationChanged() { emit configurationChanged(); } + +} // namespace Internal +} // namespace Mercurial diff --git a/src/plugins/mercurial/mercurialeditor.cpp b/src/plugins/mercurial/mercurialeditor.cpp index 0acccc9c3d6..e5d76ee60f4 100644 --- a/src/plugins/mercurial/mercurialeditor.cpp +++ b/src/plugins/mercurial/mercurialeditor.cpp @@ -44,8 +44,8 @@ #include #include -using namespace Mercurial::Internal; -using namespace Mercurial; +namespace Mercurial { +namespace Internal { MercurialEditorWidget::MercurialEditorWidget() : exactIdentifier12(QLatin1String(Constants::CHANGEIDEXACT12)), @@ -109,3 +109,6 @@ QStringList MercurialEditorWidget::annotationPreviousVersions(const QString &rev // Retrieve parent revisions return MercurialPlugin::client()->parentRevisionsSync(workingDirectory, fi.fileName(), revision); } + +} // namespace Internal +} // namespace Mercurial diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index 2abe3532cf6..d741721ebeb 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -202,8 +202,6 @@ void MercurialPlugin::createMenu() createRepositoryActions(context); mercurialContainer->addSeparator(context); createRepositoryManagementActions(context); - mercurialContainer->addSeparator(context); - createLessUsedActions(context); // Request the Tools menu and add the Mercurial menu to it Core::ActionContainer *toolsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_TOOLS)); @@ -658,13 +656,6 @@ void MercurialPlugin::createRepositoryManagementActions(const Core::Context &con // mercurialContainer->addAction(command); } -void MercurialPlugin::createLessUsedActions(const Core::Context &context) -{ - //TODO create menue for these options - Q_UNUSED(context); - return; -} - void MercurialPlugin::updateActions(VcsBasePlugin::ActionState as) { if (!enableMenuAction(as, m_menuAction)) { diff --git a/src/plugins/mercurial/mercurialplugin.h b/src/plugins/mercurial/mercurialplugin.h index 413c1d6ff7f..29dba6c6284 100644 --- a/src/plugins/mercurial/mercurialplugin.h +++ b/src/plugins/mercurial/mercurialplugin.h @@ -135,7 +135,6 @@ private: void createDirectoryActions(const Core::Context &context); void createRepositoryActions(const Core::Context &context); void createRepositoryManagementActions(const Core::Context &context); - void createLessUsedActions(const Core::Context &context); // Variables static MercurialPlugin *m_instance; diff --git a/src/plugins/mercurial/optionspage.cpp b/src/plugins/mercurial/optionspage.cpp index 44ab3898117..672c2c05864 100644 --- a/src/plugins/mercurial/optionspage.cpp +++ b/src/plugins/mercurial/optionspage.cpp @@ -38,8 +38,8 @@ #include -using namespace Mercurial::Internal; -using namespace Mercurial; +namespace Mercurial { +namespace Internal { OptionsPageWidget::OptionsPageWidget(QWidget *parent) : QWidget(parent) @@ -101,3 +101,6 @@ void OptionsPage::finish() { delete optionsPageWidget; } + +} // namespace Internal +} // namespace Mercurial diff --git a/src/plugins/mercurial/revertdialog.cpp b/src/plugins/mercurial/revertdialog.cpp index 7edd20150ce..bfb93f324a0 100644 --- a/src/plugins/mercurial/revertdialog.cpp +++ b/src/plugins/mercurial/revertdialog.cpp @@ -30,7 +30,8 @@ #include "revertdialog.h" -using namespace Mercurial::Internal; +namespace Mercurial { +namespace Internal { RevertDialog::RevertDialog(QWidget *parent) : QDialog(parent), @@ -48,3 +49,6 @@ QString RevertDialog::revision() const { return m_ui->revisionLineEdit->text(); } + +} // namespace Internal +} // namespace Mercurial diff --git a/src/plugins/mercurial/srcdestdialog.cpp b/src/plugins/mercurial/srcdestdialog.cpp index fa49c791e44..56cea035c6a 100644 --- a/src/plugins/mercurial/srcdestdialog.cpp +++ b/src/plugins/mercurial/srcdestdialog.cpp @@ -37,7 +37,9 @@ #include using namespace VcsBase; -using namespace Mercurial::Internal; + +namespace Mercurial { +namespace Internal { SrcDestDialog::SrcDestDialog(Direction dir, QWidget *parent) : QDialog(parent), @@ -118,3 +120,6 @@ QUrl SrcDestDialog::getRepoUrl() const url = settings.value(QLatin1String("paths/default")).toUrl(); return url; } + +} // namespace Internal +} // namespace Mercurial diff --git a/src/plugins/perforce/perforcechecker.cpp b/src/plugins/perforce/perforcechecker.cpp index e9413976725..ccb515b1233 100644 --- a/src/plugins/perforce/perforcechecker.cpp +++ b/src/plugins/perforce/perforcechecker.cpp @@ -181,8 +181,7 @@ void PerforceChecker::parseOutput(const QString &response) return; } // Check existence. No precise check here, might be a symlink - const QFileInfo fi(repositoryRoot); - if (fi.exists()) { + if (QFileInfo::exists(repositoryRoot)) { emitSucceeded(repositoryRoot); } else { emitFailed(tr("The repository \"%1\" does not exist."). diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index c1dd6ad92c5..5689471d9f4 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -203,10 +203,8 @@ void AbstractProcessStep::run(QFutureInterface &fi) } } - - QString effectiveCommand = m_param.effectiveCommand(); - if (!QFileInfo(effectiveCommand).exists()) { + if (!QFileInfo::exists(effectiveCommand)) { processStartupFailed(); fi.reportResult(false); emit finished(); diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index 7ae211d4a79..d4a90fb0792 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -75,6 +75,8 @@ BuildConfiguration::BuildConfiguration(Target *target, Core::Id id) : connect(target, SIGNAL(kitChanged()), this, SLOT(handleKitUpdate())); connect(this, SIGNAL(environmentChanged()), this, SLOT(emitBuildDirectoryChanged())); + + ctor(); } BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *source) : @@ -92,29 +94,23 @@ BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *sourc connect(target, SIGNAL(kitChanged()), this, SLOT(handleKitUpdate())); + + ctor(); } -void BuildConfiguration::setupMacroExpander() +void BuildConfiguration::ctor() { Utils::MacroExpander *expander = macroExpander(); - - expander->registerSubProvider( - [this] { return target()->kit()->macroExpander(); }); - - // Legacy support. - expander->registerVariable(Constants::VAR_CURRENTPROJECT_NAME, - QCoreApplication::translate("ProjectExplorer", "Name of current project"), - [this] { return target()->project()->displayName(); }); - - expander->registerVariable(Constants::VAR_CURRENTBUILD_NAME, - QCoreApplication::translate("ProjectExplorer", "Name of current build"), - [this] { return displayName(); }); - - expander->registerVariable("sourceDir", tr("Source directory"), - [this] { return target()->project()->projectDirectory().toUserOutput(); }); + expander->setDisplayName(tr("Build Settings")); + expander->setAccumulating(true); + expander->registerSubProvider([this] { return target()->macroExpander(); }); expander->registerVariable("buildDir", tr("Build directory"), [this] { return buildDirectory().toUserOutput(); }); + + expander->registerVariable(Constants::VAR_CURRENTBUILD_NAME, + QCoreApplication::translate("ProjectExplorer", "Name of current build"), + [this] { return displayName(); }, false); } BuildConfiguration::~BuildConfiguration() diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h index 283b33a4e82..313cc97f2e4 100644 --- a/src/plugins/projectexplorer/buildconfiguration.h +++ b/src/plugins/projectexplorer/buildconfiguration.h @@ -107,7 +107,7 @@ private slots: private: void emitEnvironmentChanged(); - void setupMacroExpander(); + void ctor(); bool m_clearSystemEnvironment; QList m_userEnvironmentChanges; diff --git a/src/plugins/projectexplorer/clangparser.cpp b/src/plugins/projectexplorer/clangparser.cpp index 7b5835835c8..a93a9583e83 100644 --- a/src/plugins/projectexplorer/clangparser.cpp +++ b/src/plugins/projectexplorer/clangparser.cpp @@ -55,8 +55,6 @@ ClangParser::ClangParser() : m_expectSnippet(false) { setObjectName(QLatin1String("ClangParser")); - - appendOutputParser(new LdParser); } void ClangParser::stdError(const QString &line) diff --git a/src/plugins/projectexplorer/deployconfiguration.cpp b/src/plugins/projectexplorer/deployconfiguration.cpp index debe8b0be18..1c39a177b52 100644 --- a/src/plugins/projectexplorer/deployconfiguration.cpp +++ b/src/plugins/projectexplorer/deployconfiguration.cpp @@ -31,6 +31,7 @@ #include "deployconfiguration.h" #include "buildsteplist.h" +#include "buildconfiguration.h" #include "kitinformation.h" #include "project.h" #include "projectexplorer.h" @@ -53,6 +54,7 @@ DeployConfiguration::DeployConfiguration(Target *target, Core::Id id) : m_stepList->setDefaultDisplayName(tr("Deploy")); //: Default DeployConfiguration display name setDefaultDisplayName(tr("Deploy locally")); + ctor(); } DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *source) : @@ -63,6 +65,18 @@ DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *so // Do not clone stepLists here, do that in the derived constructor instead // otherwise BuildStepFactories might reject to set up a BuildStep for us // since we are not yet the derived class! + ctor(); +} + +void DeployConfiguration::ctor() +{ + Utils::MacroExpander *expander = macroExpander(); + expander->setDisplayName(tr("Deploy Settings")); + expander->setAccumulating(true); + expander->registerSubProvider([this]() -> Utils::MacroExpander * { + BuildConfiguration *bc = target()->activeBuildConfiguration(); + return bc ? bc->macroExpander() : target()->macroExpander(); + }); } DeployConfiguration::~DeployConfiguration() diff --git a/src/plugins/projectexplorer/deployconfiguration.h b/src/plugins/projectexplorer/deployconfiguration.h index f7500d1d088..aed56110912 100644 --- a/src/plugins/projectexplorer/deployconfiguration.h +++ b/src/plugins/projectexplorer/deployconfiguration.h @@ -76,6 +76,8 @@ protected: void cloneSteps(DeployConfiguration *source); private: + void ctor(); + BuildStepList *m_stepList; }; diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp index 29e5fb011bd..cc5e050118e 100644 --- a/src/plugins/projectexplorer/editorconfiguration.cpp +++ b/src/plugins/projectexplorer/editorconfiguration.cpp @@ -116,8 +116,7 @@ EditorConfiguration::EditorConfiguration() : d(new EditorConfigurationPrivate) d->m_defaultCodeStyle->setDisplayName(tr("Project", "Settings")); d->m_defaultCodeStyle->setId("Project"); // if setCurrentDelegate is 0 values are read from *this prefs - d->m_defaultCodeStyle->setCurrentDelegate(d->m_useGlobal - ? TextEditorSettings::codeStyle() : 0); + d->m_defaultCodeStyle->setCurrentDelegate(TextEditorSettings::codeStyle()); connect(SessionManager::instance(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)), this, SLOT(slotAboutToRemoveProject(ProjectExplorer::Project*))); @@ -224,8 +223,6 @@ QVariantMap EditorConfiguration::toMap() const void EditorConfiguration::fromMap(const QVariantMap &map) { - d->m_useGlobal = map.value(kUseGlobal, d->m_useGlobal).toBool(); - const QByteArray &codecName = map.value(kCodec, d->m_textCodec->name()).toByteArray(); d->m_textCodec = QTextCodec::codecForName(codecName); if (!d->m_textCodec) @@ -251,6 +248,7 @@ void EditorConfiguration::fromMap(const QVariantMap &map) d->m_behaviorSettings.fromMap(kPrefix, map); d->m_extraEncodingSettings.fromMap(kPrefix, map); d->m_marginSettings.fromMap(kPrefix, map); + setUseGlobalSettings(map.value(kUseGlobal, d->m_useGlobal).toBool()); } void EditorConfiguration::configureEditor(BaseTextEditor *textEditor) const @@ -280,8 +278,7 @@ void EditorConfiguration::deconfigureEditor(BaseTextEditor *textEditor) const void EditorConfiguration::setUseGlobalSettings(bool use) { d->m_useGlobal = use; - d->m_defaultCodeStyle->setCurrentDelegate(d->m_useGlobal - ? TextEditorSettings::codeStyle() : 0); + d->m_defaultCodeStyle->setCurrentDelegate(use ? TextEditorSettings::codeStyle() : 0); foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) { if (TextEditorWidget *widget = qobject_cast(editor->widget())) { Project *project = SessionManager::projectForFile(editor->document()->filePath()); diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index bd896eeeaf0..9c0cf68a8bc 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -97,7 +97,8 @@ static QByteArray runGcc(const FileName &gcc, const QStringList &arguments, cons return QByteArray(); } - const QByteArray stdErr = cpp.readAllStandardError(); + const QByteArray stdErr = SynchronousProcess::normalizeNewlines( + QString::fromLocal8Bit(cpp.readAllStandardError())).toLocal8Bit(); if (cpp.exitCode() != 0) { qWarning().nospace() << Q_FUNC_INFO << ": " << gcc.toUserOutput() << ' ' @@ -106,7 +107,8 @@ static QByteArray runGcc(const FileName &gcc, const QStringList &arguments, cons return QByteArray(); } - QByteArray data = cpp.readAllStandardOutput(); + QByteArray data = SynchronousProcess::normalizeNewlines( + QString::fromLocal8Bit(cpp.readAllStandardOutput())).toLocal8Bit(); if (!data.isEmpty() && !data.endsWith('\n')) data.append('\n'); data.append(stdErr); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.cpp index ce6e1f79d0f..4aaf185be35 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonprojectpage.cpp @@ -32,6 +32,8 @@ #include +#include + #include #include @@ -43,12 +45,9 @@ JsonProjectPage::JsonProjectPage(QWidget *parent) : void JsonProjectPage::initializePage() { - if (Core::DocumentManager::useProjectsDirectory()) { - setPath(Core::DocumentManager::projectsDirectory()); - } else { - if (JsonWizard *wiz = qobject_cast(wizard())) - setPath(wiz->value(QLatin1String("InitialPath")).toString()); - } + JsonWizard *wiz = qobject_cast(wizard()); + QTC_ASSERT(wiz, return); + setPath(wiz->value(QLatin1String("InitialPath")).toString()); setProjectName(uniqueProjectName(path())); } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp index cfd78667900..d490d9907e1 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp @@ -44,12 +44,24 @@ namespace ProjectExplorer { JsonWizard::JsonWizard(QWidget *parent) : Utils::Wizard(parent) { + setMinimumSize(800, 500); m_expander.registerExtraResolver([this](const QString &name, QString *ret) -> bool { QVariant v = value(name); - if (v.isValid()) - *ret = v.toString(); + if (v.isValid()) { + if (v.type() == QVariant::Bool) + *ret = v.toBool() ? QLatin1String("true") : QString(); + else + *ret = v.toString(); + } return v.isValid(); }); + m_expander.registerPrefix("Exists", tr("Check whether a variable exists. Returns \"true\" if it does and an empty string if not."), + [this](const QString &value) -> QString + { + const QString key = QString::fromLatin1("%{") + value + QLatin1Char('}'); + return m_expander.expand(key) == key ? QString() : QLatin1String("true"); + }); + } JsonWizard::~JsonWizard() @@ -150,14 +162,12 @@ void JsonWizard::accept() Utils::Wizard::accept(); QString errorMessage; - GeneratorFiles list = fileList(); - - if (list.isEmpty()) + if (fileList().isEmpty()) return; emit prePromptForOverwrite(m_files); JsonWizardGenerator::OverwriteResult overwrite = - JsonWizardGenerator::promptForOverwrite(&list, &errorMessage); + JsonWizardGenerator::promptForOverwrite(&m_files, &errorMessage); if (overwrite == JsonWizardGenerator::OverwriteError) { if (!errorMessage.isEmpty()) QMessageBox::warning(this, tr("Failed to Overwrite Files"), errorMessage); @@ -165,27 +175,27 @@ void JsonWizard::accept() } emit preFormatFiles(m_files); - if (!JsonWizardGenerator::formatFiles(this, &list, &errorMessage)) { + if (!JsonWizardGenerator::formatFiles(this, &m_files, &errorMessage)) { if (!errorMessage.isEmpty()) QMessageBox::warning(this, tr("Failed to Format Files"), errorMessage); return; } emit preWriteFiles(m_files); - if (!JsonWizardGenerator::writeFiles(this, &list, &errorMessage)) { + if (!JsonWizardGenerator::writeFiles(this, &m_files, &errorMessage)) { if (!errorMessage.isEmpty()) QMessageBox::warning(this, tr("Failed to Write Files"), errorMessage); return; } emit postProcessFiles(m_files); - if (!JsonWizardGenerator::postWrite(this, &list, &errorMessage)) { + if (!JsonWizardGenerator::postWrite(this, &m_files, &errorMessage)) { if (!errorMessage.isEmpty()) QMessageBox::warning(this, tr("Failed to Post-Process Files"), errorMessage); return; } emit filesReady(m_files); - if (!JsonWizardGenerator::allDone(this, &list, &errorMessage)) { + if (!JsonWizardGenerator::allDone(this, &m_files, &errorMessage)) { if (!errorMessage.isEmpty()) QMessageBox::warning(this, tr("Failed to Open Files"), errorMessage); return; diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index 0c3aadc945d..419ec171cb6 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -82,6 +82,7 @@ static const char DATA_KEY[] = "data"; static const char PAGE_SUB_TITLE_KEY[] = "trSubTitle"; static const char PAGE_SHORT_TITLE_KEY[] = "trShortTitle"; static const char PAGE_INDEX_KEY[] = "index"; +static const char PAGE_ENABLED_EXPRESSION_KEY[] = "enabled"; static const char OPTIONS_KEY[] = "options"; static const char PLATFORM_INDEPENDENT_KEY[] = "platformIndependent"; @@ -180,13 +181,15 @@ static JsonWizardFactory::Page parsePage(const QVariant &value, QString *errorMe bool ok; int index = data.value(QLatin1String(PAGE_INDEX_KEY), -1).toInt(&ok); if (!ok) { - *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizardFactory", "Page with typeId \"%1\" has invalid index.") + *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizardFactory", "Page with typeId \"%1\" has invalid \"index\".") .arg(typeId.toString()); return p; } - QVariant varVal = data.value(QLatin1String(DATA_KEY)); - if (!factory->validateData(typeId, varVal, errorMessage)) + QVariant enabled = data.value(QLatin1String(PAGE_ENABLED_EXPRESSION_KEY), true); + + QVariant subData = data.value(QLatin1String(DATA_KEY)); + if (!factory->validateData(typeId, subData, errorMessage)) return p; p.typeId = typeId; @@ -194,7 +197,8 @@ static JsonWizardFactory::Page parsePage(const QVariant &value, QString *errorMe p.subTitle = subTitle; p.shortTitle = shortTitle; p.index = index; - p.data = varVal; + p.data = subData; + p.enabled = enabled; return p; } @@ -392,6 +396,10 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS foreach (const Page &data, m_pages) { QTC_ASSERT(data.isValid(), continue); + + if (!JsonWizard::boolFromVariant(data.enabled, wizard.expander())) + continue; + JsonWizardPageFactory *factory = Utils::findOr(s_pageFactories, 0, [&data](JsonWizardPageFactory *f) { return f->canCreate(data.typeId); @@ -511,7 +519,7 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir, strVal = data.value(QLatin1String(ICON_KEY)).toString(); if (!strVal.isEmpty()) { strVal = baseDir.absoluteFilePath(strVal); - if (!QFileInfo(strVal).exists()) { + if (!QFileInfo::exists(strVal)) { *errorMessage = tr("Icon \"%1\" not found.").arg(strVal); return false; } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h index d708ada1c41..e4da75e2545 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h @@ -76,6 +76,7 @@ public: QString shortTitle; int index; // page index in the wizard Core::Id typeId; + QVariant enabled; QVariant data; }; diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp index 7fc8acbb5ff..e2eedbdb7e9 100644 --- a/src/plugins/projectexplorer/kit.cpp +++ b/src/plugins/projectexplorer/kit.cpp @@ -103,13 +103,16 @@ public: // without relying on the currentKit() discovery process there. m_macroExpander.registerVariable(Constants::VAR_CURRENTKIT_NAME, tr("The name of the currently active kit."), - [kit] { return kit->displayName(); }); + [kit] { return kit->displayName(); }, + false); m_macroExpander.registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME, tr("The name of the currently active kit in a filesystem friendly version."), - [kit] { return kit->fileSystemFriendlyName(); }); + [kit] { return kit->fileSystemFriendlyName(); }, + false); m_macroExpander.registerVariable(Constants::VAR_CURRENTKIT_ID, tr("The id of the currently active kit."), - [kit] { return kit->id().toString(); }); + [kit] { return kit->id().toString(); }, + false); } QString m_unexpandedDisplayName; diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index 6c280312601..34732b0c12c 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -159,7 +159,7 @@ void KitManager::restoreKits() // read all kits from user file KitList userKits; FileName userSettingsFile(settingsFileName()); - if (userSettingsFile.toFileInfo().exists()) + if (userSettingsFile.exists()) userKits = restoreKits(userSettingsFile); foreach (Kit *k, userKits.kits) { if (k->isSdkProvided()) diff --git a/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp b/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp index 6c02c78c3c7..99e32555c6f 100644 --- a/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp +++ b/src/plugins/projectexplorer/localapplicationrunconfiguration.cpp @@ -44,13 +44,11 @@ namespace ProjectExplorer { LocalApplicationRunConfiguration::LocalApplicationRunConfiguration(Target *target, Core::Id id) : RunConfiguration(target, id) { - setupMacroExpander(); } LocalApplicationRunConfiguration::LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc) : RunConfiguration(target, rc) { - setupMacroExpander(); } LocalApplicationRunConfiguration::~LocalApplicationRunConfiguration() @@ -62,17 +60,4 @@ void LocalApplicationRunConfiguration::addToBaseEnvironment(Utils::Environment & Q_UNUSED(env); } -void LocalApplicationRunConfiguration::setupMacroExpander() -{ - // Legacy - macroExpander()->registerSubProvider([this]() -> Utils::MacroExpander * { - if (BuildConfiguration *bc = activeBuildConfiguration()) - return bc->macroExpander(); - return 0; - }); - - macroExpander()->registerVariable("sourceDir", tr("Project source directory"), - [this] { return target()->project()->projectDirectory().toUserOutput(); }); -} - } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/localapplicationrunconfiguration.h b/src/plugins/projectexplorer/localapplicationrunconfiguration.h index d9b6d15dacf..52bc7670034 100644 --- a/src/plugins/projectexplorer/localapplicationrunconfiguration.h +++ b/src/plugins/projectexplorer/localapplicationrunconfiguration.h @@ -54,9 +54,6 @@ public: protected: explicit LocalApplicationRunConfiguration(Target *target, Core::Id id); explicit LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc); - -private: - void setupMacroExpander(); }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.cpp b/src/plugins/projectexplorer/localapplicationruncontrol.cpp index d2d877ce662..6b264799b59 100644 --- a/src/plugins/projectexplorer/localapplicationruncontrol.cpp +++ b/src/plugins/projectexplorer/localapplicationruncontrol.cpp @@ -99,7 +99,7 @@ void LocalApplicationRunControl::start() if (m_executable.isEmpty()) { appendMessage(tr("No executable specified.") + QLatin1Char('\n'), Utils::ErrorMessageFormat); emit finished(); - } else if (!QFileInfo(m_executable).exists()){ + } else if (!QFileInfo::exists(m_executable)) { appendMessage(tr("Executable %1 does not exist.").arg(QDir::toNativeSeparators(m_executable)) + QLatin1Char('\n'), Utils::ErrorMessageFormat); emit finished(); diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index ba78e46eb06..17a312e9710 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -549,13 +549,20 @@ KitAreaWidget::KitAreaWidget(QWidget *parent) : QWidget(parent), m_layout(new QGridLayout(this)), m_kit(0) { m_layout->setMargin(3); +} + +KitAreaWidget::~KitAreaWidget() +{ setKit(0); } void KitAreaWidget::setKit(Kit *k) { + if (k == m_kit) + return; + foreach (KitConfigWidget *w, m_widgets) - w->deleteLater(); + delete(w); m_widgets.clear(); foreach (QLabel *l, m_labels) l->deleteLater(); diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.h b/src/plugins/projectexplorer/miniprojecttargetselector.h index a13e30dab68..ad91702371c 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.h +++ b/src/plugins/projectexplorer/miniprojecttargetselector.h @@ -95,6 +95,7 @@ class KitAreaWidget : public QWidget Q_OBJECT public: explicit KitAreaWidget(QWidget *parent = 0); + ~KitAreaWidget(); public slots: void setKit(ProjectExplorer::Kit *k); diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 104d6b41d94..cbf49621660 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -308,7 +308,7 @@ static QString winExpandDelayedEnvReferences(QString in, const Utils::Environmen Utils::Environment MsvcToolChain::readEnvironmentSetting(Utils::Environment& env) const { Utils::Environment result = env; - if (!QFileInfo(m_vcvarsBat).exists()) + if (!QFileInfo::exists(m_vcvarsBat)) return result; QMap envPairs; @@ -354,7 +354,7 @@ bool MsvcToolChain::isValid() const if (!AbstractMsvcToolChain::isValid()) return false; QString vcVarsBat = MsvcToolChainFactory::vcVarsBatFor(QFileInfo(m_vcvarsBat).absolutePath(), m_varsBatArg); - return QFileInfo(vcVarsBat).exists(); + return QFileInfo::exists(vcVarsBat); } MsvcToolChain::MsvcToolChain() : diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index e66e3be0049..230b2404a90 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -126,6 +126,7 @@ #include #include #include +#include #include #include diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp index f7bcbda1192..7da0fe82100 100644 --- a/src/plugins/projectexplorer/projectwizardpage.cpp +++ b/src/plugins/projectexplorer/projectwizardpage.cpp @@ -73,7 +73,7 @@ class BestNodeSelector { public: BestNodeSelector(const QString &commonDirectory, const QStringList &files); - void inspect(AddNewTree *tree); + void inspect(AddNewTree *tree, bool isContextNode); AddNewTree *bestChoice() const; bool deploys(); QString deployingProjects() const; @@ -102,7 +102,7 @@ BestNodeSelector::BestNodeSelector(const QString &commonDirectory, const QString // Otherwise consider their common path. Either a direct match on the directory // or the directory with the longest matching path (list containing"/project/subproject1" // matching common path "/project/subproject1/newuserpath"). -void BestNodeSelector::inspect(AddNewTree *tree) +void BestNodeSelector::inspect(AddNewTree *tree, bool isContextNode) { FolderNode *node = tree->node(); if (node->nodeType() == ProjectNodeType) { @@ -115,7 +115,7 @@ void BestNodeSelector::inspect(AddNewTree *tree) return; const QString projectDirectory = ProjectExplorerPlugin::directoryFor(node); const int projectDirectorySize = projectDirectory.size(); - if (!m_commonDirectory.startsWith(projectDirectory)) + if (!m_commonDirectory.startsWith(projectDirectory) && !isContextNode) return; bool betterMatch = tree->priority() > 0 && (projectDirectorySize > m_bestMatchLength @@ -173,7 +173,7 @@ static inline AddNewTree *buildAddProjectTree(ProjectNode *root, const QString & if (projectPath.isEmpty() || root->canAddSubProject(projectPath)) { FolderNode::AddNewInformation info = root->addNewInformation(QStringList() << projectPath, contextNode); AddNewTree *item = new AddNewTree(root, children, info); - selector->inspect(item); + selector->inspect(item, root == contextNode); return item; } } @@ -208,7 +208,7 @@ static inline AddNewTree *buildAddFilesTree(FolderNode *root, const QStringList if (list.contains(AddNewFile) && !list.contains(InheritedFromParent)) { FolderNode::AddNewInformation info = root->addNewInformation(files, contextNode); AddNewTree *item = new AddNewTree(root, children, info); - selector->inspect(item); + selector->inspect(item, root == contextNode); return item; } if (children.isEmpty()) diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index f9e6e348ec6..3429c483fea 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -253,6 +253,14 @@ void RunConfiguration::addExtraAspect(IRunConfigurationAspect *aspect) void RunConfiguration::ctor() { connect(this, SIGNAL(enabledChanged()), this, SIGNAL(requestRunActionsUpdate())); + + Utils::MacroExpander *expander = macroExpander(); + expander->setDisplayName(tr("Run Settings")); + expander->setAccumulating(true); + expander->registerSubProvider([this]() -> Utils::MacroExpander * { + BuildConfiguration *bc = target()->activeBuildConfiguration(); + return bc ? bc->macroExpander() : target()->macroExpander(); + }); } /*! diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 3fdcd075623..03f12e319b6 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -320,8 +320,14 @@ void SessionManager::addProjects(const QList &projects) } } - foreach (Project *pro, clearedList) + foreach (Project *pro, clearedList) { emit m_instance->projectAdded(pro); + configureEditors(pro); + connect(pro, &Project::fileListChanged, + [pro](){ + configureEditors(pro); + }); + } if (clearedList.count() == 1) emit m_instance->singleProjectAdded(clearedList.first()); @@ -611,6 +617,19 @@ void SessionManager::configureEditor(Core::IEditor *editor, const QString &fileN } } +void SessionManager::configureEditors(Project *project) +{ + foreach (IDocument *document, DocumentModel::openedDocuments()) { + if (d->projectContainsFile(project, document->filePath())) { + foreach (IEditor *editor, DocumentModel::editorsForDocument(document)) { + if (TextEditor::BaseTextEditor *textEditor = qobject_cast(editor)) { + project->editorConfiguration()->configureEditor(textEditor); + } + } + } + } +} + void SessionManager::removeProjects(QList remove) { QMap resMap; @@ -883,7 +902,7 @@ bool SessionManager::loadSession(const QString &session) // Try loading the file FileName fileName = sessionNameToFileName(session); PersistentSettingsReader reader; - if (fileName.toFileInfo().exists()) { + if (fileName.exists()) { if (!reader.load(fileName)) { QMessageBox::warning(ICore::dialogParent(), tr("Error while restoring session"), tr("Could not restore session %1").arg(fileName.toUserOutput())); @@ -919,7 +938,7 @@ bool SessionManager::loadSession(const QString &session) d->m_sessionName = session; EditorManager::updateWindowTitles(); - if (fileName.toFileInfo().exists()) { + if (fileName.exists()) { d->m_virginSession = false; ProgressManager::addTask(d->m_future.future(), tr("Loading Session"), @@ -1021,7 +1040,7 @@ QStringList SessionManager::projectsForSessionName(const QString &session) { const FileName fileName = sessionNameToFileName(session); PersistentSettingsReader reader; - if (fileName.toFileInfo().exists()) { + if (fileName.exists()) { if (!reader.load(fileName)) { qWarning() << "Could not restore session" << fileName.toUserOutput(); return QStringList(); diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h index 0f02bc1b08c..2670614d201 100644 --- a/src/plugins/projectexplorer/session.h +++ b/src/plugins/projectexplorer/session.h @@ -147,6 +147,8 @@ private slots: static void configureEditor(Core::IEditor *editor, const QString &fileName); static void markSessionFileDirty(bool makeDefaultVirginDirty = true); static void projectDisplayNameChanged(); +private: + static void configureEditors(Project *project); }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index c638ab47c73..5ef3435ee8b 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -752,7 +752,7 @@ SettingsAccessor::IssueInfo SettingsAccessor::findIssues(const QVariantMap &data defaultSettingsPath.appendString(m_userSuffix); int version = versionFromMap(data); - if (!path.toFileInfo().exists()) { + if (!path.exists()) { return result; } else if (data.isEmpty() || version < firstSupportedVersion() || version > currentVersion()) { result.title = QApplication::translate("Utils::SettingsAccessor", "No Valid Settings Found"); diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index 11b25292c67..4569ea28efc 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -138,6 +138,22 @@ Target::Target(Project *project, Kit *k) : this, SLOT(handleKitUpdates(ProjectExplorer::Kit*))); connect(km, SIGNAL(kitRemoved(ProjectExplorer::Kit*)), this, SLOT(handleKitRemoval(ProjectExplorer::Kit*))); + + Utils::MacroExpander *expander = macroExpander(); + expander->setDisplayName(tr("Target Settings")); + expander->setAccumulating(true); + + expander->registerSubProvider([this] { return kit()->macroExpander(); }); + + expander->registerVariable("sourceDir", tr("Source directory"), + [project] { return project->projectDirectory().toUserOutput(); }); + + // Legacy support. + expander->registerVariable(Constants::VAR_CURRENTPROJECT_NAME, + QCoreApplication::translate("ProjectExplorer", "Name of current project"), + [project] { return project->displayName(); }, + false); + } Target::~Target() diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 74191c5f1d3..d95066a4cb8 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -475,7 +475,7 @@ void TaskWindow::triggerDefaultHandler(const QModelIndex &index) if (d->m_defaultHandler->canHandle(task)) { d->m_defaultHandler->handle(task); } else { - if (!task.file.toFileInfo().exists()) + if (!task.file.exists()) d->m_model->setFileNotFound(index, true); } } diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp index 29c432dea3e..a1abcdbb2b3 100644 --- a/src/plugins/projectexplorer/toolchainmanager.cpp +++ b/src/plugins/projectexplorer/toolchainmanager.cpp @@ -192,7 +192,7 @@ void ToolChainManager::restoreToolChains() // read all tool chains from user file. // Read legacy settings once and keep them around... FileName fileName = settingsFileName(QLatin1String(TOOLCHAIN_FILENAME)); - if (!fileName.toFileInfo().exists()) + if (!fileName.exists()) fileName = settingsFileName(QLatin1String(LEGACY_TOOLCHAIN_FILENAME)); readTcs = restoreFromFile(fileName); diff --git a/src/plugins/projectexplorer/wincetoolchain.cpp b/src/plugins/projectexplorer/wincetoolchain.cpp index 83e5a723467..55d76c1a57e 100644 --- a/src/plugins/projectexplorer/wincetoolchain.cpp +++ b/src/plugins/projectexplorer/wincetoolchain.cpp @@ -117,7 +117,7 @@ static QString winExpandDelayedEnvReferences(QString in, const Utils::Environmen Utils::Environment WinCEToolChain::readEnvironmentSetting(Utils::Environment &env) const { Utils::Environment result = env; - if (!QFileInfo(m_vcvarsBat).exists()) + if (!QFileInfo::exists(m_vcvarsBat)) return result; // Get the env pairs diff --git a/src/plugins/projectexplorer/xcodebuildparser.cpp b/src/plugins/projectexplorer/xcodebuildparser.cpp index 95107fa8e45..ce83d203723 100644 --- a/src/plugins/projectexplorer/xcodebuildparser.cpp +++ b/src/plugins/projectexplorer/xcodebuildparser.cpp @@ -41,6 +41,7 @@ namespace ProjectExplorer { static const char failureRe[] = "\\*\\* BUILD FAILED \\*\\*$"; static const char successRe[] = "\\*\\* BUILD SUCCEEDED \\*\\*$"; static const char buildRe[] = "=== BUILD (AGGREGATE )?TARGET (.*) OF PROJECT (.*) WITH .* ===$"; +static const char signatureChangeRe[] = "(.+): replacing existing signature$"; XcodebuildParser::XcodebuildParser() : m_fatalErrorCount(0), @@ -53,6 +54,8 @@ XcodebuildParser::XcodebuildParser() : QTC_CHECK(m_successRe.isValid()); m_buildRe.setPattern(QLatin1String(buildRe)); QTC_CHECK(m_buildRe.isValid()); + m_replacingSignatureRe.setPattern(QLatin1String(signatureChangeRe)); + QTC_CHECK(m_replacingSignatureRe.isValid()); } bool XcodebuildParser::hasFatalErrors() const @@ -74,6 +77,16 @@ void XcodebuildParser::stdOutput(const QString &line) m_xcodeBuildParserState = OutsideXcodebuild; return; } + if (m_replacingSignatureRe.indexIn(lne) > -1) { + Task task(Task::Warning, + QCoreApplication::translate("ProjectExplorer::XcodebuildParser", + "Replacing signature"), + Utils::FileName::fromString(m_replacingSignatureRe.cap(1)), /* filename */ + -1, /* line */ + Constants::TASK_CATEGORY_COMPILE); + taskAdded(task); + return; + } IOutputParser::stdError(line); } else { IOutputParser::stdOutput(line); @@ -241,6 +254,26 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing_data() Constants::TASK_CATEGORY_COMPILE)) << QString() << XcodebuildParser::UnknownXcodebuildState; + QTest::newRow("inside catch codesign replace signature") + << XcodebuildParser::InXcodebuild + << QString::fromLatin1("/somepath/somefile.app: replacing existing signature") << OutputParserTester::STDOUT + << QString() << QString() + << (QList() + << Task(Task::Warning, + QCoreApplication::translate("ProjectExplorer::XcodebuildParser", + "Replacing signature"), + Utils::FileName::fromString(QLatin1String("/somepath/somefile.app")), /* filename */ + -1, /* line */ + Constants::TASK_CATEGORY_COMPILE)) + << QString() + << XcodebuildParser::InXcodebuild; + QTest::newRow("outside forward codesign replace signature") + << XcodebuildParser::OutsideXcodebuild + << QString::fromLatin1("/somepath/somefile.app: replacing existing signature") << OutputParserTester::STDOUT + << QString::fromLatin1("/somepath/somefile.app: replacing existing signature\n") << QString() + << QList() + << QString() + << XcodebuildParser::OutsideXcodebuild; } void ProjectExplorerPlugin::testXcodebuildParserParsing() diff --git a/src/plugins/projectexplorer/xcodebuildparser.h b/src/plugins/projectexplorer/xcodebuildparser.h index 49baff868c6..bb49fce88fe 100644 --- a/src/plugins/projectexplorer/xcodebuildparser.h +++ b/src/plugins/projectexplorer/xcodebuildparser.h @@ -59,6 +59,7 @@ private: QRegExp m_failureRe; QRegExp m_successRe; QRegExp m_buildRe; + QRegExp m_replacingSignatureRe; XcodebuildStatus m_xcodeBuildParserState; QString m_lastTarget; QString m_lastProject; diff --git a/src/plugins/pythoneditor/PythonEditor.json.in b/src/plugins/pythoneditor/PythonEditor.json.in index 196c5ddefcd..fb4a59eddc8 100644 --- a/src/plugins/pythoneditor/PythonEditor.json.in +++ b/src/plugins/pythoneditor/PythonEditor.json.in @@ -12,7 +12,7 @@ \"\", \"Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\" ], - \"Category\" : \"Python\", + \"Category\" : \"Other Languages\", \"Description\" : \"Editor and file creation wizards for Python. Example plugin for QtCreator API demonstration.\", \"Url\" : \"http://www.qt-project.org\", $$dependencyList diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp index 0fc02608af6..5fdaf2a256d 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp @@ -91,7 +91,7 @@ void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, // Some people don't like it when files are created as a side effect of opening a project, // so do not store the build graph if the build directory does not exist yet. - params.setDryRun(!QFileInfo(dir).exists()); + params.setDryRun(!QFileInfo::exists(dir)); params.setBuildRoot(dir); params.setProjectFilePath(m_projectFilePath); diff --git a/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp b/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp index 6a462da9f55..b4c24c7f9d9 100644 --- a/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp +++ b/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp @@ -104,7 +104,7 @@ void AndroidPackageInstallationStep::run(QFutureInterface &fi) QString error; foreach (const QString &dir, m_androidDirsToClean) { Utils::FileName androidDir = Utils::FileName::fromString(dir); - if (!dir.isEmpty() && androidDir.toFileInfo().exists()) { + if (!dir.isEmpty() && androidDir.exists()) { emit addOutput(tr("Removing directory %1").arg(dir), MessageOutput); if (!Utils::FileUtils::removeRecursively(androidDir, &error)) { emit addOutput(error, ErrorOutput); diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp index 01167b093d2..97639768f32 100644 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp @@ -35,6 +35,7 @@ #include "qmakebuildconfiguration.h" #include +#include #include #include #include @@ -294,6 +295,8 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm connect(qmakeRunConfiguration, SIGNAL(enabledChanged()), this, SLOT(runConfigurationEnabledChange())); + + Core::VariableChooser::addSupportForChildWidgets(this, m_qmakeRunConfiguration->macroExpander()); } DesktopQmakeRunConfigurationWidget::~DesktopQmakeRunConfigurationWidget() diff --git a/src/plugins/qmakeprojectmanager/makestep.cpp b/src/plugins/qmakeprojectmanager/makestep.cpp index 4ebb4a2b9e4..9f69c18e5d8 100644 --- a/src/plugins/qmakeprojectmanager/makestep.cpp +++ b/src/plugins/qmakeprojectmanager/makestep.cpp @@ -281,7 +281,7 @@ void MakeStep::run(QFutureInterface & fi) return; } - if (!QFileInfo(m_makeFileToCheck).exists()) { + if (!QFileInfo::exists(m_makeFileToCheck)) { if (!ignoreReturnValue()) emit addOutput(tr("Cannot find Makefile. Check your build settings."), BuildStep::MessageOutput); fi.reportResult(ignoreReturnValue()); diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp index b183f685ed9..adb7b2731a9 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.cpp +++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp @@ -144,7 +144,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur if (fi.isDir()) { QDir subDir(fi.absoluteFilePath()); QString subProject = subDir.filePath(subDir.dirName() + QLatin1String(".pro")); - if (QFileInfo(subProject).exists()) + if (QFileInfo::exists(subProject)) fileName = subProject; else return link; diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp index 37f871cb2a2..f0eb2a96f23 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp @@ -361,7 +361,7 @@ MakeStep *QmakeBuildConfiguration::makeStep() const QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportFrom(const QString &makefile) { QMakeStep *qs = qmakeStep(); - if (QFileInfo(makefile).exists() && qs) { + if (QFileInfo::exists(makefile) && qs) { FileName qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(makefile); BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit()); if (!version) @@ -507,7 +507,7 @@ FileName QmakeBuildConfiguration::extractSpecFromArguments(QString *args, // if it is the former we need to get the canonical form // for the other one we don't need to do anything if (parsedSpec.toFileInfo().isRelative()) { - if (QFileInfo(directory + QLatin1Char('/') + parsedSpec.toString()).exists()) + if (QFileInfo::exists(directory + QLatin1Char('/') + parsedSpec.toString())) parsedSpec = FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString()); else parsedSpec = FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString()); diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index d2c2cc8e8d2..26b3a6de6df 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -1437,7 +1437,7 @@ bool QmakeProject::requiresTargetPanel() const // but more pratical then duplicated the code everywhere QString QmakeProject::disabledReasonForRunConfiguration(const QString &proFilePath) { - if (!QFileInfo(proFilePath).exists()) + if (!QFileInfo::exists(proFilePath)) return tr("The .pro file \"%1\" does not exist.") .arg(QFileInfo(proFilePath).fileName()); diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro index c9da3d35cce..af4371dd0a9 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro @@ -25,8 +25,6 @@ HEADERS += \ wizards/librarywizard.h \ wizards/librarywizarddialog.h \ wizards/guiappwizarddialog.h \ - wizards/emptyprojectwizard.h \ - wizards/emptyprojectwizarddialog.h \ wizards/testwizard.h \ wizards/testwizarddialog.h \ wizards/testwizardpage.h \ @@ -75,8 +73,6 @@ SOURCES += \ wizards/librarywizard.cpp \ wizards/librarywizarddialog.cpp \ wizards/guiappwizarddialog.cpp \ - wizards/emptyprojectwizard.cpp \ - wizards/emptyprojectwizarddialog.cpp \ wizards/testwizard.cpp \ wizards/testwizarddialog.cpp \ wizards/testwizardpage.cpp \ diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs index 5e073230131..929c868d5f9 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs @@ -91,8 +91,6 @@ QtcPlugin { "abstractmobileappwizard.cpp", "abstractmobileappwizard.h", "consoleappwizard.cpp", "consoleappwizard.h", "consoleappwizarddialog.cpp", "consoleappwizarddialog.h", - "emptyprojectwizard.cpp", "emptyprojectwizard.h", - "emptyprojectwizarddialog.cpp", "emptyprojectwizarddialog.h", "filespage.cpp", "filespage.h", "guiappwizard.cpp", "guiappwizard.h", "guiappwizarddialog.cpp", "guiappwizarddialog.h", diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index 1a11e8ac4f2..0d682cdccf4 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -41,7 +41,6 @@ #include "wizards/guiappwizard.h" #include "wizards/librarywizard.h" #include "wizards/testwizard.h" -#include "wizards/emptyprojectwizard.h" #include "wizards/subdirsprojectwizard.h" #include "wizards/qtquickappwizard.h" #include "customwidgetwizard/customwidgetwizard.h" @@ -109,7 +108,6 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation); - addAutoReleasedObject(new EmptyProjectWizard); addAutoReleasedObject(new SubdirsProjectWizard); addAutoReleasedObject(new GuiAppWizard); addAutoReleasedObject(new ConsoleAppWizard); diff --git a/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizard.cpp deleted file mode 100644 index b76557c19dd..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizard.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://www.qt.io/licensing. For further information -** use the contact form at http://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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "emptyprojectwizard.h" - -#include "emptyprojectwizarddialog.h" - -#include -#include - -#include - -namespace QmakeProjectManager { -namespace Internal { - -EmptyProjectWizard::EmptyProjectWizard() -{ - setId(QLatin1String("U.Qt4Empty")); - setCategory(QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY)); - setDisplayCategory(QCoreApplication::translate("ProjectExplorer", - ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY)); - setDisplayName(tr("Empty Qt Project")); - setDescription(tr("Creates a qmake-based project without any files. This allows you to create " - "an application without any default classes.")); - setIcon(QIcon(QLatin1String(":/wizards/images/gui.png"))); - setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT)); -} - -Core::BaseFileWizard *EmptyProjectWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const -{ - EmptyProjectWizardDialog *dialog = new EmptyProjectWizardDialog(displayName(), icon(), parent, parameters); - dialog->setProjectName(EmptyProjectWizardDialog::uniqueProjectName(parameters.defaultPath())); - return dialog; -} - -Core::GeneratedFiles - EmptyProjectWizard::generateFiles(const QWizard *w, - QString * /*errorMessage*/) const -{ - const EmptyProjectWizardDialog *wizard = qobject_cast< const EmptyProjectWizardDialog *>(w); - const QtProjectParameters params = wizard->parameters(); - const QString projectPath = params.projectPath(); - const QString profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix()); - - Core::GeneratedFile profile(profileName); - profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute | Core::GeneratedFile::OpenEditorAttribute); - return Core::GeneratedFiles() << profile; -} - -} // namespace Internal -} // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizard.h b/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizard.h deleted file mode 100644 index c772448b7b3..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizard.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://www.qt.io/licensing. For further information -** use the contact form at http://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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef EMPTYPROJECTWIZARD_H -#define EMPTYPROJECTWIZARD_H - -#include "qtwizard.h" - -namespace QmakeProjectManager { -namespace Internal { - -class EmptyProjectWizard : public QtWizard -{ - Q_OBJECT - -public: - EmptyProjectWizard(); - -private: - Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const; - - Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const; -}; - -} // namespace Internal -} // namespace QmakeProjectManager - -#endif // EMPTYPROJECTWIZARD_H diff --git a/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizarddialog.cpp deleted file mode 100644 index 8f36537bca8..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizarddialog.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://www.qt.io/licensing. For further information -** use the contact form at http://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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "emptyprojectwizarddialog.h" -#include - -namespace QmakeProjectManager { -namespace Internal { - -EmptyProjectWizardDialog::EmptyProjectWizardDialog(const QString &templateName, - const QIcon &icon, - QWidget *parent, const Core::WizardDialogParameters ¶meters) : - BaseQmakeProjectWizardDialog(false, parent, parameters) -{ - setWindowIcon(icon); - setWindowTitle(templateName); - - setIntroDescription(tr("This wizard generates an empty Qt project. " - "Add files to it later on by using the other wizards.")); - - if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))) - addTargetSetupPage(); - - addExtensionPages(parameters.extensionPages()); -} - -QtProjectParameters EmptyProjectWizardDialog::parameters() const -{ - QtProjectParameters rc; - rc.type = QtProjectParameters::EmptyProject; - rc.fileName = projectName(); - rc.path = path(); - return rc; -} - -} // namespace Internal -} // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizarddialog.h b/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizarddialog.h deleted file mode 100644 index fa4c79379e9..00000000000 --- a/src/plugins/qmakeprojectmanager/wizards/emptyprojectwizarddialog.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://www.qt.io/licensing. For further information -** use the contact form at http://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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef EMPTYPROJECTWIZARDDIALOG_H -#define EMPTYPROJECTWIZARDDIALOG_H - -#include "qtwizard.h" - -namespace QmakeProjectManager { -namespace Internal { - -struct QtProjectParameters; - -class EmptyProjectWizardDialog : public BaseQmakeProjectWizardDialog -{ - Q_OBJECT -public: - explicit EmptyProjectWizardDialog(const QString &templateName, - const QIcon &icon, - QWidget *parent, - const Core::WizardDialogParameters ¶meters); - - QtProjectParameters parameters() const; -}; - -} // namespace Internal -} // namespace QmakeProjectManager - -#endif // EMPTYPROJECTWIZARDDIALOG_H diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp index 70707a2c390..8b4e5d62d6b 100644 --- a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp @@ -291,14 +291,38 @@ void QtQuickApp::handleCurrentProFileTemplateLine(const QString &line, } #ifndef CREATORLESSTEST + +static QFileInfoList allFilesRecursive(const QString &path) +{ + const QDir currentDirectory(path); + + QFileInfoList allFiles = currentDirectory.entryInfoList(QDir::Files); + + foreach (const QFileInfo &subDirectory, currentDirectory.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) + allFiles.append(allFilesRecursive(subDirectory.absoluteFilePath())); + + return allFiles; +} + Core::GeneratedFiles QtQuickApp::generateFiles(QString *errorMessage) const { Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage); + + const QFileInfoList templateFiles = allFilesRecursive(originsRoot()); + + //Deploy additional .qml files + foreach (const QFileInfo &templateFile, templateFiles) { + QString targetFileName = templateFile.fileName(); + if (templateFile.suffix() == QLatin1String("qml") + && targetFileName != QLatin1String("main.qml")) + files.append(file(readBlob(templateFile.absoluteFilePath(), errorMessage), outputPathBase() + targetFileName)); + } + if (!useExistingMainQml()) { files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQmlFile, errorMessage), path(MainQml))); files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute); } - if (QFileInfo(path(MainQrcOrigin)).exists()) { + if (QFileInfo::exists(path(MainQrcOrigin))) { files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQrcFile, errorMessage), path(MainQrc))); } if (!qrcDeployment().isEmpty()) { diff --git a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp index 84e0c9c6bd2..2ac6f9b2e8b 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp @@ -132,11 +132,11 @@ void FileResourcesModel::openFileDialog() //Next we try to fall back to the path any file browser was opened with - if (!QFileInfo(path).exists()) + if (!QFileInfo::exists(path)) path = s_lastBrowserPath; //The last fallback is to try the path of the document - if (!QFileInfo(path).exists()) + if (!QFileInfo::exists(path)) path = modelPath; QString newFile = QFileDialog::getOpenFileName(Core::ICore::mainWindow(), tr("Open File"), path, m_filter); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index 002695840ca..4d3b6274782 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -93,7 +93,7 @@ PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyE m_view(new Quick2PropertyEditorView), m_propertyEditorTransaction(new PropertyEditorTransaction(propertyEditor)), m_dummyPropertyEditorValue(new PropertyEditorValue()), m_contextObject(new PropertyEditorContextObject()) { - Q_ASSERT(QFileInfo(":/images/button_normal.png").exists()); + Q_ASSERT(QFileInfo::exists(":/images/button_normal.png")); m_view->engine()->setOutputWarningsToStandardError( !qgetenv("QTCREATOR_QTQUICKDESIGNER_PROPERTYEDITOR_SHOW_WARNINGS").isEmpty()); @@ -436,7 +436,7 @@ QString PropertyEditorQmlBackend::fileFromUrl(const QUrl &url) bool PropertyEditorQmlBackend::checkIfUrlExists(const QUrl &url) { - return (QFileInfo(fileFromUrl(url)).exists()); + return QFileInfo::exists(fileFromUrl(url)); } void PropertyEditorQmlBackend::emitSelectionToBeChanged() diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml index 0f9ed319aa0..696ccb89cfb 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml @@ -45,7 +45,7 @@ Column { Label { text: qsTr("Text") - toolTip: qsTr("Text displayed on the button.") + tooltip: qsTr("Text displayed on the button.") } SecondColumnLayout { @@ -57,7 +57,7 @@ Column { Label { text: qsTr("Checked") - toolTip: qsTr("State of the button.") + tooltip: qsTr("State of the button.") } SecondColumnLayout { @@ -74,7 +74,7 @@ Column { Label { text: qsTr("Checkable") - toolTip: qsTr("Determines whether the button is checkable or not.") + tooltip: qsTr("Determines whether the button is checkable or not.") } SecondColumnLayout { @@ -97,7 +97,7 @@ Column { Label { text: qsTr("Enabled") - toolTip: qsTr("Determines whether the button is enabled or not.") + tooltip: qsTr("Determines whether the button is enabled or not.") } SecondColumnLayout { @@ -114,7 +114,7 @@ Column { Label { text: qsTr("Default button") - toolTip: qsTr("Sets the button as the default button in a dialog.") + tooltip: qsTr("Sets the button as the default button in a dialog.") } SecondColumnLayout { @@ -130,7 +130,7 @@ Column { Label { text: qsTr("Tool tip") - toolTip: qsTr("The tool tip shown for the button.") + tooltip: qsTr("The tool tip shown for the button.") } SecondColumnLayout { @@ -142,7 +142,7 @@ Column { Label { text: qsTr("Focus on press") - toolTip: "Determines whether the button gets focus if pressed." + tooltip: qsTr("Determines whether the button gets focus if pressed.") } SecondColumnLayout { @@ -159,7 +159,7 @@ Column { Label { text: qsTr("Icon source") - toolTip: qsTr("The URL of an icon resource.") + tooltip: qsTr("The URL of an icon resource.") } SecondColumnLayout { diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml index 6d5a8d39c60..a684c490050 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml @@ -45,7 +45,7 @@ Column { Label { text: qsTr("Text") - toolTip: qsTr("Text shown on the check box.") + tooltip: qsTr("Text shown on the check box.") } SecondColumnLayout { @@ -57,7 +57,7 @@ Column { Label { text: qsTr("Checked") - toolTip: qsTr("State of the check box.") + tooltip: qsTr("State of the check box.") } SecondColumnLayout { @@ -74,7 +74,7 @@ Column { Label { text: qsTr("Focus on press") - toolTip: qsTr("Determines whether the check box gets focus if pressed.") + tooltip: qsTr("Determines whether the check box gets focus if pressed.") } SecondColumnLayout { diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/ComboBoxSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/ComboBoxSpecifics.qml index 0b24f92d206..c46e9345666 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/ComboBoxSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/ComboBoxSpecifics.qml @@ -45,7 +45,7 @@ Column { Label { text: qsTr("Focus on press") - toolTip: "Determines whether the combobox gets focus if pressed." + tooltip: qsTr("Determines whether the combobox gets focus if pressed.") } SecondColumnLayout { diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml index 92f1eac1038..45d5ec2b9d7 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml @@ -45,7 +45,7 @@ Column { Label { text: qsTr("Text") - toolTip: qsTr("Text label for the radio button.") + tooltip: qsTr("Text label for the radio button.") } SecondColumnLayout { @@ -57,7 +57,7 @@ Column { Label { text: qsTr("Checked") - toolTip: qsTr("Determines whether the radio button is checked or not.") + tooltip: qsTr("Determines whether the radio button is checked or not.") } SecondColumnLayout { @@ -75,7 +75,7 @@ Column { Label { text: qsTr("Focus on press") - toolTip: "Determines whether the radio button gets focus if pressed." + tooltip: qsTr("Determines whether the radio button gets focus if pressed.") } SecondColumnLayout { diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/SliderSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/SliderSpecifics.qml index 138baa49259..105d438af04 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/SliderSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/SliderSpecifics.qml @@ -35,7 +35,7 @@ Section { SectionLayout { Label { text: qsTr("Value") - toolTip: qsTr("Current value of the Slider. The default value is 0.0.") + tooltip: qsTr("Current value of the Slider. The default value is 0.0.") } SecondColumnLayout { SpinBox { @@ -50,7 +50,7 @@ Section { } Label { text: qsTr("Maximum value") - toolTip: qsTr("Maximum value of the slider. The default value is 1.0.") + tooltip: qsTr("Maximum value of the slider. The default value is 1.0.") } SecondColumnLayout { SpinBox { @@ -66,7 +66,7 @@ Section { } Label { text: qsTr("Minimum value") - toolTip: qsTr("Minimum value of the slider. The default value is 0.0.") + tooltip: qsTr("Minimum value of the slider. The default value is 0.0.") } SecondColumnLayout { SpinBox { @@ -82,7 +82,7 @@ Section { } Label { text: qsTr("Orientation") - toolTip: qsTr("Layout orientation of the slider.") + tooltip: qsTr("Layout orientation of the slider.") } SecondColumnLayout { OrientationCombobox { @@ -93,7 +93,7 @@ Section { } Label { text: qsTr("Step size") - toolTip: qsTr("Indicates the slider step size.") + tooltip: qsTr("Indicates the slider step size.") } SecondColumnLayout { SpinBox { @@ -108,7 +108,7 @@ Section { Label { text: qsTr("Active focus on press") - toolTip: qsTr("Indicates whether the slider should receive active focus when pressed.") + tooltip: qsTr("Indicates whether the slider should receive active focus when pressed.") } SecondColumnLayout { @@ -121,7 +121,7 @@ Section { } Label { text: qsTr("Tick marks enabled") - toolTip: qsTr("Indicates whether the slider should display tick marks at step intervals.") + tooltip: qsTr("Indicates whether the slider should display tick marks at step intervals.") } SecondColumnLayout { @@ -134,7 +134,7 @@ Section { } Label { text: qsTr("Update value while dragging") - toolTip: qsTr("Determines whether the current value should be updated while the user is moving the slider handle, or only when the button has been released.") + tooltip: qsTr("Determines whether the current value should be updated while the user is moving the slider handle, or only when the button has been released.") } SecondColumnLayout { diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/SplitViewSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/SplitViewSpecifics.qml index 85009a0196b..41ce3fdbda1 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/SplitViewSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/SplitViewSpecifics.qml @@ -44,7 +44,7 @@ Column { SectionLayout { Label { text: qsTr("Orientation") - toolTip: qsTr("Orientation of the split view.") + tooltip: qsTr("Orientation of the split view.") } SecondColumnLayout { diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/TabViewSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/TabViewSpecifics.qml index ee65e7047e9..367862a0f46 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/TabViewSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/TabViewSpecifics.qml @@ -54,7 +54,7 @@ Column { Label { text: qsTr("Frame visible") - toolTip: qsTr("Determines the visibility of the tab frame around contents.") + tooltip: qsTr("Determines the visibility of the tab frame around contents.") } SecondColumnLayout { @@ -70,7 +70,7 @@ Column { Label { text: qsTr("Tabs visible") - toolTip: qsTr("Determines the visibility of the the tab bar.") + tooltip: qsTr("Determines the visibility of the the tab bar.") } SecondColumnLayout { @@ -86,7 +86,7 @@ Column { Label { text: qsTr("Tab position") - toolTip: qsTr("Determines the position of the tabs.") + tooltip: qsTr("Determines the position of the tabs.") } SecondColumnLayout { diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/TextAreaSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/TextAreaSpecifics.qml index eed8d801321..19a8149b592 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/TextAreaSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/TextAreaSpecifics.qml @@ -59,7 +59,7 @@ Column { Label { text: qsTr("Text") - toolTip: qsTr("Text shown on the text area.") + tooltip: qsTr("Text shown on the text area.") } SecondColumnLayout { @@ -72,7 +72,7 @@ Column { Label { text: qsTr("Read only") - toolTip: qsTr("Determines whether the text area is read only.") + tooltip: qsTr("Determines whether the text area is read only.") } SecondColumnLayout { @@ -88,7 +88,7 @@ Column { Label { text: qsTr("Document margins") - toolTip: qsTr("Margins of the text area.") + tooltip: qsTr("Margins of the text area.") } SectionLayout { @@ -107,7 +107,7 @@ Column { Label { text: qsTr("Frame width") - toolTip: qsTr("Width of the frame.") + tooltip: qsTr("Width of the frame.") } SectionLayout { @@ -125,7 +125,7 @@ Column { Label { text: qsTr("Contents frame") - toolTip: qsTr("Determines whether the frame around contents is shown.") + tooltip: qsTr("Determines whether the frame around contents is shown.") } SecondColumnLayout { @@ -157,7 +157,7 @@ Column { Label { text: qsTr("Highlight on focus") - toolTip: qsTr("Determines whether the text area is highlighted on focus.") + tooltip: qsTr("Determines whether the text area is highlighted on focus.") } SecondColumnLayout { @@ -173,7 +173,7 @@ Column { Label { text: qsTr("Tab changes focus") - toolTip: qsTr("Determines whether tab changes the focus of the text area.") + tooltip: qsTr("Determines whether tab changes the focus of the text area.") } SecondColumnLayout { @@ -189,7 +189,7 @@ Column { Label { text: qsTr("Focus on press") - toolTip: qsTr("Determines whether the text area gets focus if pressed.") + tooltip: qsTr("Determines whether the text area gets focus if pressed.") } SecondColumnLayout { diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/TextFieldSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/TextFieldSpecifics.qml index 6ee8e7f6c5a..a76ca9a69f4 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/TextFieldSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/TextFieldSpecifics.qml @@ -45,7 +45,7 @@ Column { Label { text: qsTr("Text") - toolTip: qsTr("Text shown on the text field.") + tooltip: qsTr("Text shown on the text field.") } SecondColumnLayout { @@ -59,7 +59,7 @@ Column { Label { text: qsTr("Placeholder text") - toolTip: qsTr("Placeholder text.") + tooltip: qsTr("Placeholder text.") } SecondColumnLayout { @@ -71,7 +71,7 @@ Column { Label { text: qsTr("Read only") - toolTip: qsTr("Determines whether the text field is read only.") + tooltip: qsTr("Determines whether the text field is read only.") } SecondColumnLayout { @@ -87,7 +87,7 @@ Column { Label { text: qsTr("Input mask") - toolTip: qsTr("Restricts the valid text in the text field.") + tooltip: qsTr("Restricts the valid text in the text field.") } SecondColumnLayout { @@ -99,7 +99,7 @@ Column { Label { text: qsTr("Echo mode") - toolTip: qsTr("Specifies how the text is displayed in the text field.") + tooltip: qsTr("Specifies how the text is displayed in the text field.") } SecondColumnLayout { diff --git a/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.cpp b/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.cpp index b7f876605c2..728f66f5cce 100644 --- a/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.cpp +++ b/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.cpp @@ -114,7 +114,7 @@ void AddTabDesignerAction::addNewTab() QString directoryPath = QFileInfo(selectionContext().view()->model()->fileUrl().toLocalFile()).absolutePath(); QString newFilePath = directoryPath +QStringLiteral("/") + tabName + QStringLiteral(".qml"); - if (QFileInfo(newFilePath).exists()) { + if (QFileInfo::exists(newFilePath)) { QMessageBox::warning(Core::ICore::mainWindow(), tr("Naming Error"), tr("Component already exists.")); } else { const QString sourceString = QStringLiteral("import QtQuick 2.1\nimport QtQuick.Controls 1.0\n\nItem {\n anchors.fill: parent\n}"); diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index a30f6714190..735126a7717 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -111,7 +111,7 @@ bool PuppetCreator::useOnlyFallbackPuppet() const { DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); return settings.useOnlyFallbackPuppet - || !qgetenv("USE_ONLY_FALLBACK_PUPPET").isEmpty(); + || !qgetenv("USE_ONLY_FALLBACK_PUPPET").isEmpty() || m_kit == 0 || !m_kit->isValid(); } PuppetCreator::PuppetCreator(ProjectExplorer::Kit *kit, const QString &qtCreatorVersion) @@ -166,7 +166,8 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath, puppetProcess->setProcessEnvironment(processEnvironment()); QObject::connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), puppetProcess, SLOT(kill())); QObject::connect(puppetProcess, SIGNAL(finished(int,QProcess::ExitStatus)), handlerObject, finishSlot); - bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QML_PUPPET_OUTPUT").isEmpty(); + QString forwardOutputMode = qgetenv("FORWARD_QML_PUPPET_OUTPUT").toLower(); + bool fowardQmlpuppetOutput = forwardOutputMode == puppetMode || forwardOutputMode == "true"; if (fowardQmlpuppetOutput) { puppetProcess->setProcessChannelMode(QProcess::MergedChannels); QObject::connect(puppetProcess, SIGNAL(readyRead()), handlerObject, outputSlot); @@ -261,7 +262,7 @@ void PuppetCreator::createQml1PuppetExecutableIfMissing() { m_availablePuppetType = FallbackPuppet; - if (!useOnlyFallbackPuppet() && m_kit) { + if (!useOnlyFallbackPuppet()) { if (m_qml1PuppetForKitPuppetHash.contains(m_kit->id())) { m_availablePuppetType = m_qml1PuppetForKitPuppetHash.value(m_kit->id()); } else if (checkQmlpuppetIsReady()) { @@ -283,7 +284,7 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing() { m_availablePuppetType = FallbackPuppet; - if (!useOnlyFallbackPuppet() && m_kit) { + if (!useOnlyFallbackPuppet()) { if (m_qml2PuppetForKitPuppetHash.contains(m_kit->id())) { m_availablePuppetType = m_qml2PuppetForKitPuppetHash.value(m_kit->id()); } else if (checkQml2PuppetIsReady()) { diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp index 0e880b4f947..f8b29b58fdc 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp @@ -189,7 +189,7 @@ QmlItemNode QmlItemNode::createQmlItemNodeFromImage(AbstractView *view, const QS QString relativeImageName = imageName; //use relative path - if (QFileInfo(view->model()->fileUrl().toLocalFile()).exists()) { + if (QFileInfo::exists(view->model()->fileUrl().toLocalFile())) { QDir fileDir(QFileInfo(view->model()->fileUrl().toLocalFile()).absolutePath()); relativeImageName = fileDir.relativeFilePath(imageName); propertyPairList.append(qMakePair(PropertyName("source"), QVariant(relativeImageName))); diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp index b91a5c7eb71..d4ebebcd566 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.cpp +++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp @@ -921,7 +921,7 @@ bool QmlJSCompletionAssistProcessor::completeFileName(const QString &relativeBas } else { directoryPrefix = fileInfo.path(); } - if (!QFileInfo(directoryPrefix).exists()) + if (!QFileInfo::exists(directoryPrefix)) return false; QDirIterator dirIterator(directoryPrefix, diff --git a/src/plugins/qmljstools/qmljsbundleprovider.cpp b/src/plugins/qmljstools/qmljsbundleprovider.cpp index 64a2e121474..80a8d93445d 100644 --- a/src/plugins/qmljstools/qmljsbundleprovider.cpp +++ b/src/plugins/qmljstools/qmljsbundleprovider.cpp @@ -63,7 +63,7 @@ QmlBundle BasicBundleProvider::defaultBundle(const QString &bundleInfoName) QString defaultBundlePath = Core::ICore::resourcePath() + QLatin1String("/qml-type-descriptions/") + bundleInfoName; - if (!QFileInfo(defaultBundlePath).exists()) { + if (!QFileInfo::exists(defaultBundlePath)) { qWarning() << "BasicBundleProvider: ERROR " << defaultBundlePath << " not found"; return res; diff --git a/src/plugins/qmlprofiler/qml/CategoryLabel.qml b/src/plugins/qmlprofiler/qml/CategoryLabel.qml index 3550d7d27b5..da26964af9f 100644 --- a/src/plugins/qmlprofiler/qml/CategoryLabel.qml +++ b/src/plugins/qmlprofiler/qml/CategoryLabel.qml @@ -243,7 +243,7 @@ Item { implicitHeight: txt.height - 1 enabled: expanded || trigger(qmlProfilerModelProxy.count(modelIndex)) > 0 iconSource: expanded ? "arrow_down.png" : "arrow_right.png" - tooltip: qsTr(expanded ? "Collapse category" : "Expand category.") + tooltip: expanded ? qsTr("Collapse category") : qsTr("Expand category.") onClicked: qmlProfilerModelProxy.setExpanded(modelIndex, !expanded); } diff --git a/src/plugins/qmlprofiler/qmlprofiler.qbs b/src/plugins/qmlprofiler/qmlprofiler.qbs index 9b2ae622d5c..5ab6e00af6b 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.qbs +++ b/src/plugins/qmlprofiler/qmlprofiler.qbs @@ -4,7 +4,6 @@ import QtcPlugin QtcPlugin { name: "QmlProfiler" - minimumQtVersion: "5.1" Depends { name: "Qt"; submodules: ["widgets", "network"] } Depends { name: "Qt.quick"; condition: product.condition; } diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 52e25b56c4d..3d0eabf9af4 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -292,8 +292,7 @@ void QmlProjectRunConfiguration::updateEnabled() qmlFileFound = !mainScript().isEmpty(); } - bool newValue = QFileInfo(executable()).exists() && qmlFileFound; - + bool newValue = QFileInfo::exists(executable()) && qmlFileFound; // Always emit change signal to force reevaluation of run/debug buttons m_isEnabled = newValue; diff --git a/src/plugins/qnx/bardescriptoreditorentrypointwidget.cpp b/src/plugins/qnx/bardescriptoreditorentrypointwidget.cpp index 5634d1727d7..58f2f208369 100644 --- a/src/plugins/qnx/bardescriptoreditorentrypointwidget.cpp +++ b/src/plugins/qnx/bardescriptoreditorentrypointwidget.cpp @@ -145,7 +145,7 @@ void BarDescriptorEditorEntryPointWidget::handleIconChanged(const QString &path) emit imageRemoved(m_prevIconPath); m_prevIconPath = path; - if (QFileInfo(path).exists()) + if (QFileInfo::exists(path)) emit imageAdded(path); } diff --git a/src/plugins/qnx/bardescriptorfilenodemanager.cpp b/src/plugins/qnx/bardescriptorfilenodemanager.cpp index 7bb71a4e66e..5d3f815ef69 100644 --- a/src/plugins/qnx/bardescriptorfilenodemanager.cpp +++ b/src/plugins/qnx/bardescriptorfilenodemanager.cpp @@ -148,7 +148,7 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro if (!projectNode) continue; - if (!QFileInfo(package.appDescriptorPath()).exists()) { + if (!QFileInfo::exists(package.appDescriptorPath())) { if (!attemptCreate) continue; @@ -241,7 +241,7 @@ bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project content.replace(QLatin1String("TARGETNAME"), targetName); content.replace(QLatin1String("ID"), QLatin1String("com.example.") + projectName); - if (project->projectDirectory().appendPath(QLatin1String("qml")).toFileInfo().exists()) + if (project->projectDirectory().appendPath(QLatin1String("qml")).exists()) content.replace(QLatin1String(""), QLatin1String(" qml\n")); diff --git a/src/plugins/qnx/blackberryapilevelconfiguration.cpp b/src/plugins/qnx/blackberryapilevelconfiguration.cpp index cf4e05c436b..0aa3b538346 100644 --- a/src/plugins/qnx/blackberryapilevelconfiguration.cpp +++ b/src/plugins/qnx/blackberryapilevelconfiguration.cpp @@ -130,10 +130,10 @@ void BlackBerryApiLevelConfiguration::ctor() QString host = qnxHost().toString(); FileName qmake4Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qmake"))); FileName qmake5Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qt5/qmake"))); - if (qmake4Path.toFileInfo().exists()) + if (qmake4Path.exists()) m_qmake4BinaryFile = qmake4Path; - if (qmake5Path.toFileInfo().exists()) + if (qmake5Path.exists()) m_qmake5BinaryFile = qmake5Path; } @@ -183,8 +183,8 @@ bool BlackBerryApiLevelConfiguration::isValid() const return QnxBaseConfiguration::isValid() && ((!m_qmake4BinaryFile.isEmpty() || !m_qmake5BinaryFile.isEmpty()) && (m_autoDetectionSource.isEmpty() || - m_autoDetectionSource.toFileInfo().exists()) - && (!m_sysRoot.isEmpty() && m_sysRoot.toFileInfo().exists())); + m_autoDetectionSource.exists()) + && (!m_sysRoot.isEmpty() && m_sysRoot.exists())); } @@ -276,10 +276,10 @@ QStringList BlackBerryApiLevelConfiguration::validationErrors() const if (m_qmake4BinaryFile.isEmpty() && m_qmake5BinaryFile.isEmpty()) errorStrings << tr("- No Qt version found."); - if (!m_autoDetectionSource.isEmpty() && !m_autoDetectionSource.toFileInfo().exists()) + if (!m_autoDetectionSource.isEmpty() && !m_autoDetectionSource.exists()) errorStrings << tr("- No auto detection source found."); - if (m_sysRoot.isEmpty() && m_sysRoot.toFileInfo().exists()) + if (m_sysRoot.isEmpty() && m_sysRoot.exists()) errorStrings << tr("- No sysroot found."); diff --git a/src/plugins/qnx/blackberrycreatepackagestep.cpp b/src/plugins/qnx/blackberrycreatepackagestep.cpp index 7f649bb4078..dd342202e31 100644 --- a/src/plugins/qnx/blackberrycreatepackagestep.cpp +++ b/src/plugins/qnx/blackberrycreatepackagestep.cpp @@ -187,7 +187,7 @@ static bool addQtAssets(BarDescriptorAssetList &assetList, BlackBerryQtVersion * it != qtFolders.constEnd(); ++it) { const QString target = it->first; const QString qtFolder = it->second; - if (QFileInfo(qtFolder).exists()) { + if (QFileInfo::exists(qtFolder)) { BarDescriptorAsset asset; asset.source = qtFolder; asset.destination = target; diff --git a/src/plugins/qnx/blackberrydeploystep.cpp b/src/plugins/qnx/blackberrydeploystep.cpp index c101ed4f725..7084a40cd7d 100644 --- a/src/plugins/qnx/blackberrydeploystep.cpp +++ b/src/plugins/qnx/blackberrydeploystep.cpp @@ -114,7 +114,7 @@ void BlackBerryDeployStep::run(QFutureInterface &fi) QList packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages(); foreach (const BarPackageDeployInformation &info, packagesToDeploy) { - if (!QFileInfo(info.packagePath()).exists()) { + if (!QFileInfo::exists(info.packagePath())) { raiseError(tr("Package \"%1\" does not exist. Create the package first.").arg(info.packagePath())); fi.reportResult(false); return; diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwidget.cpp b/src/plugins/qnx/blackberrydeviceconfigurationwidget.cpp index 88798b48790..3c6c9345ad7 100644 --- a/src/plugins/qnx/blackberrydeviceconfigurationwidget.cpp +++ b/src/plugins/qnx/blackberrydeviceconfigurationwidget.cpp @@ -170,7 +170,7 @@ void BlackBerryDeviceConfigurationWidget::requestDebugToken() void BlackBerryDeviceConfigurationWidget::uploadDebugToken() { // check the debug token path before even laucnhing the uploader process - if (!QFileInfo(ui->debugToken->currentText()).exists()) { + if (!QFileInfo::exists(ui->debugToken->currentText())) { QMessageBox::critical(this, tr("Error"), tr("Invalid debug token path.")); return; } @@ -184,7 +184,7 @@ void BlackBerryDeviceConfigurationWidget::uploadDebugToken() void BlackBerryDeviceConfigurationWidget::updateUploadButton() { const QString path = ui->debugToken->currentText(); - ui->uploadButton->setEnabled(QFileInfo(path).exists()); + ui->uploadButton->setEnabled(QFileInfo::exists(path)); } void BlackBerryDeviceConfigurationWidget::uploadFinished(int status) diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.cpp b/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.cpp index 6f0e3f0a1c6..c4a6a4a3f31 100644 --- a/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.cpp +++ b/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.cpp @@ -391,7 +391,7 @@ bool BlackBerryDeviceConfigurationWizardConfigPage::isComplete() const bool configurationNameComplete = !m_ui->configurationNameField->text().isEmpty(); Utils::FileName fileName = Utils::FileName::fromString(m_ui->debugTokenCombo->currentText()); bool debugTokenComplete = m_holder.isSimulator || !m_holder.isProductionDevice - || (!fileName.isEmpty() && fileName.toFileInfo().exists()); + || (!fileName.isEmpty() && fileName.exists()); return configurationNameComplete && debugTokenComplete; } diff --git a/src/plugins/qnx/blackberryndksettingswidget.cpp b/src/plugins/qnx/blackberryndksettingswidget.cpp index 5aba127f1df..d8ab5b2dab4 100644 --- a/src/plugins/qnx/blackberryndksettingswidget.cpp +++ b/src/plugins/qnx/blackberryndksettingswidget.cpp @@ -188,10 +188,10 @@ void BlackBerryNDKSettingsWidget::updateConfigurationList() // TODO: Do the same if qmake, qcc, debugger are no longer detected... if (!config->isValid()) { QString toolTip = tr("Invalid target %1:").arg(config->targetName()); - if (config->isAutoDetected() && !config->autoDetectionSource().toFileInfo().exists()) + if (config->isAutoDetected() && !config->autoDetectionSource().exists()) toolTip += QLatin1Char('\n') + tr("- Target no longer installed."); - if (!config->envFile().toFileInfo().exists()) + if (!config->envFile().exists()) toolTip += QLatin1Char('\n') + tr("- No NDK environment file found."); if (config->qmake4BinaryFile().isEmpty() diff --git a/src/plugins/qnx/blackberryrunconfiguration.cpp b/src/plugins/qnx/blackberryrunconfiguration.cpp index b8dc7928fa7..bd787b39f78 100644 --- a/src/plugins/qnx/blackberryrunconfiguration.cpp +++ b/src/plugins/qnx/blackberryrunconfiguration.cpp @@ -123,7 +123,7 @@ bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map) return false; m_proFilePath = map.value(QLatin1String(Constants::QNX_PROFILEPATH_KEY)).toString(); - if (m_proFilePath.isEmpty() || !QFileInfo(m_proFilePath).exists()) + if (m_proFilePath.isEmpty() || !QFileInfo::exists(m_proFilePath)) return false; init(); diff --git a/src/plugins/qnx/blackberrysetupwidget.cpp b/src/plugins/qnx/blackberrysetupwidget.cpp index df949aaed0c..d4146b19fb5 100644 --- a/src/plugins/qnx/blackberrysetupwidget.cpp +++ b/src/plugins/qnx/blackberrysetupwidget.cpp @@ -234,7 +234,7 @@ void SigningKeysSetupItem::validate() set(Error, tr("Found legacy BlackBerry signing keys."), tr("Update")); else if (!utils.hasRegisteredKeys()) set(Error, tr("Cannot find BlackBerry signing keys."), tr("Request")); - else if (!QFileInfo(BlackBerryConfigurationManager::instance()->defaultKeystorePath()).exists()) + else if (!QFileInfo::exists(BlackBerryConfigurationManager::instance()->defaultKeystorePath())) set(Error, tr("Cannot find developer certificate."), tr("Create")); else if (utils.defaultCertificateOpeningStatus() != BlackBerrySigningUtils::Opened) set(Info, tr("Developer certificate is not opened."), tr("Open")); @@ -249,7 +249,7 @@ void SigningKeysSetupItem::fix() QDesktopServices::openUrl(QUrl(QLatin1String(Qnx::Constants::QNX_LEGACY_KEYS_URL))); } else if (!utils.hasRegisteredKeys()) { QDesktopServices::openUrl(QUrl(QLatin1String(Qnx::Constants::QNX_REGISTER_KEYS_URL))); - } else if (!QFileInfo(BlackBerryConfigurationManager::instance()->defaultKeystorePath()).exists()) { + } else if (!QFileInfo::exists(BlackBerryConfigurationManager::instance()->defaultKeystorePath())) { set(Info, tr("Opening certificate...")); utils.createCertificate(); } else if (utils.defaultCertificateOpeningStatus() != BlackBerrySigningUtils::Opened) { diff --git a/src/plugins/qnx/blackberrysigningutils.cpp b/src/plugins/qnx/blackberrysigningutils.cpp index bcc122063c8..b579ef62c02 100644 --- a/src/plugins/qnx/blackberrysigningutils.cpp +++ b/src/plugins/qnx/blackberrysigningutils.cpp @@ -69,23 +69,17 @@ BlackBerrySigningUtils::BlackBerrySigningUtils(QObject *parent) : bool BlackBerrySigningUtils::hasRegisteredKeys() { - QFileInfo cskFile(BlackBerryConfigurationManager::instance()->idTokenPath()); - - return cskFile.exists(); + return QFileInfo::exists(BlackBerryConfigurationManager::instance()->idTokenPath()); } bool BlackBerrySigningUtils::hasLegacyKeys() { - QFileInfo cskFile(BlackBerryConfigurationManager::instance()->barsignerCskPath()); - - return cskFile.exists(); + return QFileInfo::exists(BlackBerryConfigurationManager::instance()->barsignerCskPath()); } bool BlackBerrySigningUtils::hasDefaultCertificate() { - QFileInfo keystore(BlackBerryConfigurationManager::instance()->defaultKeystorePath()); - - return keystore.exists(); + return QFileInfo::exists(BlackBerryConfigurationManager::instance()->defaultKeystorePath()); } QString BlackBerrySigningUtils::cskPassword(QWidget *passwordPromptParent, bool *ok) diff --git a/src/plugins/qnx/qnxbaseconfiguration.cpp b/src/plugins/qnx/qnxbaseconfiguration.cpp index 9bbfc055914..2cd9c75f208 100644 --- a/src/plugins/qnx/qnxbaseconfiguration.cpp +++ b/src/plugins/qnx/qnxbaseconfiguration.cpp @@ -136,7 +136,7 @@ bool QnxBaseConfiguration::isValid() const void QnxBaseConfiguration::ctor(const FileName &envScript) { - QTC_ASSERT(!envScript.isEmpty() && envScript.toFileInfo().exists(), return); + QTC_ASSERT(!envScript.isEmpty() && envScript.exists(), return); m_envFile = envScript; m_qnxEnv = QnxUtils::qnxEnvironmentFromEnvFile(m_envFile.toString()); foreach (const Utils::EnvironmentItem &item, m_qnxEnv) { @@ -151,7 +151,7 @@ void QnxBaseConfiguration::ctor(const FileName &envScript) m_qnxHost.toString() + QLatin1String("/usr/bin/qcc"))); FileName armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix( m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarm-gdb"))); - if (!armlev7GdbPath.toFileInfo().exists()) { + if (!armlev7GdbPath.exists()) { armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix( m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarmv7-gdb"))); } @@ -159,13 +159,13 @@ void QnxBaseConfiguration::ctor(const FileName &envScript) FileName x86GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix( m_qnxHost.toString() + QLatin1String("/usr/bin/ntox86-gdb"))); - if (qccPath.toFileInfo().exists()) + if (qccPath.exists()) m_qccCompiler = qccPath; - if (armlev7GdbPath.toFileInfo().exists()) + if (armlev7GdbPath.exists()) m_armlev7Debugger = armlev7GdbPath; - if (x86GdbPath.toFileInfo().exists()) + if (x86GdbPath.exists()) m_x86Debugger = x86GdbPath; } diff --git a/src/plugins/qnx/qnxutils.cpp b/src/plugins/qnx/qnxutils.cpp index 549a2840e85..3596880319a 100644 --- a/src/plugins/qnx/qnxutils.cpp +++ b/src/plugins/qnx/qnxutils.cpp @@ -93,7 +93,7 @@ QList QnxUtils::qnxEnvironmentFromEnvFile(const QString { QList items; - if (!QFileInfo(fileName).exists()) + if (!QFileInfo::exists(fileName)) return items; const bool isWindows = Utils::HostOsInfo::isWindowsHost(); @@ -157,7 +157,7 @@ QList QnxUtils::qnxEnvironmentFromEnvFile(const QString bool QnxUtils::isValidNdkPath(const QString &ndkPath) { - return (QFileInfo(envFilePath(ndkPath)).exists()); + return QFileInfo::exists(envFilePath(ndkPath)); } QString QnxUtils::envFilePath(const QString &ndkPath, const QString &targetVersion) @@ -168,7 +168,7 @@ QString QnxUtils::envFilePath(const QString &ndkPath, const QString &targetVersi else if (Utils::HostOsInfo::isAnyUnixHost()) envFile = ndkPath + QLatin1String("/bbndk-env.sh"); - if (!QFileInfo(envFile).exists()) { + if (!QFileInfo::exists(envFile)) { QString version = targetVersion.isEmpty() ? defaultTargetVersion(ndkPath) : targetVersion; version = version.replace(QLatin1Char('.'), QLatin1Char('_')); if (Utils::HostOsInfo::isWindowsHost()) @@ -268,7 +268,7 @@ QString QnxUtils::sdkInstallerPath(const QString &ndkPath) { QString sdkinstallPath = Utils::HostOsInfo::withExecutableSuffix(ndkPath + QLatin1String("/qde")); - if (QFileInfo(sdkinstallPath).exists()) + if (QFileInfo::exists(sdkinstallPath)) return sdkinstallPath; return QString(); diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 423f79da1cb..0acdc2adfb0 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1016,35 +1016,30 @@ void BaseQtVersion::updateVersionInfo() const // Now check for a qt that is configured with a prefix but not installed QString installDir = qmakeProperty(m_versionInfo, "QT_HOST_BINS"); if (!installDir.isNull()) { - QFileInfo fi(installDir); - if (!fi.exists()) + if (!QFileInfo::exists(installDir)) m_installed = false; } // Framework builds for Qt 4.8 don't use QT_INSTALL_HEADERS // so we don't check on mac if (!HostOsInfo::isMacHost()) { if (!qtHeaderData.isNull()) { - const QFileInfo fi(qtHeaderData); - if (!fi.exists()) + if (!QFileInfo::exists(qtHeaderData)) m_installed = false; } } const QString qtInstallDocs = qmakeProperty(m_versionInfo, "QT_INSTALL_DOCS"); if (!qtInstallDocs.isNull()) { - const QFileInfo fi(qtInstallDocs); - if (fi.exists()) + if (QFileInfo::exists(qtInstallDocs)) m_hasDocumentation = true; } const QString qtInstallExamples = qmakeProperty(m_versionInfo, "QT_INSTALL_EXAMPLES"); if (!qtInstallExamples.isNull()) { - const QFileInfo fi(qtInstallExamples); - if (fi.exists()) + if (QFileInfo::exists(qtInstallExamples)) m_hasExamples = true; } const QString qtInstallDemos = qmakeProperty(m_versionInfo, "QT_INSTALL_DEMOS"); if (!qtInstallDemos.isNull()) { - const QFileInfo fi(qtInstallDemos); - if (fi.exists()) + if (QFileInfo::exists(qtInstallDemos)) m_hasDemos = true; } m_qtVersionString = qmakeProperty(m_versionInfo, "QT_VERSION"); @@ -1406,7 +1401,7 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash &ver QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData()); // We sometimes get a mix of different slash styles here... possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/')); - if (QFileInfo(possibleFullPath).exists()) // Only if the path exists + if (QFileInfo::exists(possibleFullPath)) // Only if the path exists mkspecFullPath = FileName::fromUserInput(possibleFullPath); } break; diff --git a/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp b/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp index 75559009190..b57288b91c5 100644 --- a/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp +++ b/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp @@ -31,6 +31,7 @@ #include "customexecutableconfigurationwidget.h" #include "customexecutablerunconfiguration.h" +#include #include #include #include @@ -118,6 +119,8 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE // or keep them on cancel if (mode == InstantApply) connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed())); + + Core::VariableChooser::addSupportForChildWidgets(this, m_runConfiguration->macroExpander()); } void CustomExecutableConfigurationWidget::environmentWasChanged() diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 653780a2990..45b46ff01f0 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -272,7 +272,7 @@ static bool isValidExampleOrDemo(ExampleItem &item) doesn't have any namespace */ QString reason; bool ok = true; - if (!item.hasSourceCode || !QFileInfo(item.projectPath).exists()) { + if (!item.hasSourceCode || !QFileInfo::exists(item.projectPath)) { ok = false; reason = QString::fromLatin1("projectPath \"%1\" empty or does not exist").arg(item.projectPath); } else if (item.imageUrl.startsWith(invalidPrefix) || !QUrl(item.imageUrl).isValid()) { diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index 71b8fe089e6..386f8e2ea76 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -35,6 +35,7 @@ #include "qtversionmanager.h" #include "qtparser.h" +#include #include #include #include @@ -59,23 +60,31 @@ QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *k) const Q_UNUSED(k); // find "Qt in PATH": - Utils::FileName qmake = Utils::BuildableHelperLibrary::findSystemQt(Utils::Environment::systemEnvironment()); - - if (qmake.isEmpty()) - return -1; - QList versionList = QtVersionManager::versions(); - BaseQtVersion *fallBack = 0; - foreach (BaseQtVersion *v, versionList) { - if (qmake == v->qmakeCommand()) - return v->uniqueId(); - if (v->type() == QLatin1String(QtSupport::Constants::DESKTOPQT) && !fallBack) - fallBack = v; - } - if (fallBack) - return fallBack->uniqueId(); + BaseQtVersion *result = findOrDefault(versionList, [](const BaseQtVersion *v) { + return v->autodetectionSource() == QLatin1String("PATH"); + }); - return -1; + if (result) + return result->uniqueId(); + + // Legacy: Check for system qmake path: Remove in 3.5 (or later): + // This check is expensive as it will potentially run binaries (qmake --version)! + const FileName qmakePath + = BuildableHelperLibrary::findSystemQt(Utils::Environment::systemEnvironment()); + + if (!qmakePath.isEmpty()) { + result = findOrDefault(versionList, [qmakePath](const BaseQtVersion *v) { + return v->qmakeCommand() == qmakePath; + }); + } + + // Use *any* desktop Qt: + result = findOrDefault(versionList, [](const BaseQtVersion *v) { + return v->type() == QLatin1String(QtSupport::Constants::DESKTOPQT); + }); + + return result ? result->uniqueId() : -1; } QList QtKitInformation::validate(const ProjectExplorer::Kit *k) const diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 59f7f3467ef..ff405cd5183 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -181,7 +181,7 @@ void QtVersionManager::triggerQtVersionRestore() saveQtVersions(); const FileName configFileName = globalSettingsFileName(); - if (configFileName.toFileInfo().exists()) { + if (configFileName.exists()) { m_configFileWatcher = new FileSystemWatcher(m_instance); connect(m_configFileWatcher, SIGNAL(fileChanged(QString)), m_fileWatcherTimer, SLOT(start())); @@ -231,7 +231,7 @@ static bool restoreQtVersions() FileName filename = settingsFileName(QLatin1String(QTVERSION_FILENAME)); // Read Qt Creator 2.5 qtversions.xml once: - if (!filename.toFileInfo().exists()) + if (!filename.exists()) filename = settingsFileName(QLatin1String(QTVERSION_LEGACY_FILENAME)); if (!reader.load(filename)) return false; @@ -440,7 +440,8 @@ static void findSystemQt() if (systemQMakePath.isNull()) return; - BaseQtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(systemQMakePath); + BaseQtVersion *version + = QtVersionFactory::createQtVersionFromQMakePath(systemQMakePath, false, QLatin1String("PATH")); if (version) { version->setUnexpandedDisplayName(BaseQtVersion::defaultUnexpandedDisplayName(systemQMakePath, true)); m_versions.insert(version->uniqueId(), version); diff --git a/src/plugins/subversion/checkoutwizard.cpp b/src/plugins/subversion/checkoutwizard.cpp index 6fe1488f951..c9f5e4918ea 100644 --- a/src/plugins/subversion/checkoutwizard.cpp +++ b/src/plugins/subversion/checkoutwizard.cpp @@ -30,6 +30,7 @@ #include "checkoutwizard.h" #include "checkoutwizardpage.h" +#include "subversionconstants.h" #include "subversionplugin.h" #include "subversionclient.h" @@ -74,7 +75,11 @@ VcsCommand *CheckoutWizard::createCommand(FileName *checkoutDir) const FileName binary = settings.binaryPath(); const QString directory = cwp->directory(); QStringList args; - args << QLatin1String("checkout") << cwp->repository() << directory; + args << QLatin1String("checkout"); + args << QLatin1String(Constants::NON_INTERACTIVE_OPTION); + if (cwp->trustServerCert()) + args << QLatin1String("--trust-server-cert"); + args << cwp->repository() << directory; const QString workingDirectory = cwp->path(); *checkoutDir = FileName::fromString(workingDirectory + QLatin1Char('/') + directory); diff --git a/src/plugins/subversion/checkoutwizardpage.cpp b/src/plugins/subversion/checkoutwizardpage.cpp index 66af5d02f54..a6a7a1a6474 100644 --- a/src/plugins/subversion/checkoutwizardpage.cpp +++ b/src/plugins/subversion/checkoutwizardpage.cpp @@ -30,16 +30,26 @@ #include "checkoutwizardpage.h" +#include + namespace Subversion { namespace Internal { CheckoutWizardPage::CheckoutWizardPage(QWidget *parent) : - VcsBase::BaseCheckoutWizardPage(parent) + VcsBase::BaseCheckoutWizardPage(parent), + m_trustServerCertBox(new QCheckBox(tr("Trust Server Certificate"))) { setTitle(tr("Location")); setSubTitle(tr("Specify repository URL, checkout directory and path.")); setRepositoryLabel(tr("Repository:")); setBranchSelectorVisible(false); + + addLocalControl(m_trustServerCertBox); +} + +bool CheckoutWizardPage::trustServerCert() const +{ + return m_trustServerCertBox->isChecked(); } QString CheckoutWizardPage::directoryFromRepository(const QString &repoIn) const diff --git a/src/plugins/subversion/checkoutwizardpage.h b/src/plugins/subversion/checkoutwizardpage.h index def7c1608de..f81096ec9a9 100644 --- a/src/plugins/subversion/checkoutwizardpage.h +++ b/src/plugins/subversion/checkoutwizardpage.h @@ -33,6 +33,10 @@ #include +QT_BEGIN_NAMESPACE +class QCheckBox; +QT_END_NAMESPACE + namespace Subversion { namespace Internal { @@ -41,8 +45,13 @@ class CheckoutWizardPage : public VcsBase::BaseCheckoutWizardPage { public: CheckoutWizardPage(QWidget *parent = 0); + bool trustServerCert() const; + protected: QString directoryFromRepository(const QString &r) const; + +private: + QCheckBox *m_trustServerCertBox; }; } // namespace Internal diff --git a/src/plugins/subversion/subversionclient.cpp b/src/plugins/subversion/subversionclient.cpp index 9e0b8df70c0..028f0e037ff 100644 --- a/src/plugins/subversion/subversionclient.cpp +++ b/src/plugins/subversion/subversionclient.cpp @@ -119,9 +119,11 @@ VcsCommand *SubversionClient::createCommitCmd(const QString &repositoryRoot, QStringList(extraOptions) << authenticationOptions(SubversionClient::CommitCommand) << QLatin1String(Constants::NON_INTERACTIVE_OPTION) + << QLatin1String("--encoding") << QLatin1String("utf8") << QLatin1String("--file") << commitMessageFile; VcsCommand *cmd = createCommand(repositoryRoot); + cmd->addFlags(VcsBasePlugin::ShowStdOutInLogWindow); QStringList args(vcsCommandString(CommitCommand)); cmd->addJob(args << svnExtraOptions << files); return cmd; @@ -209,15 +211,30 @@ QStringList SubversionClient::addAuthenticationOptions(const QStringList &args, return rc; } +QString SubversionClient::synchronousTopic(const QString &repository) +{ + QStringList args; + args << QLatin1String("info"); + + QByteArray stdOut; + if (!vcsFullySynchronousExec(repository, args, &stdOut)) + return QString(); + + const QString revisionString = QLatin1String("Revision: "); + // stdOut is ASCII only (at least in those areas we care about). + QString output = SynchronousProcess::normalizeNewlines(QString::fromLocal8Bit(stdOut)); + foreach (const QString &line, output.split(QLatin1Char('\n'))) { + if (line.startsWith(revisionString)) + return QString::fromLatin1("r") + line.mid(revisionString.count()); + } + return QString(); +} + void SubversionClient::diff(const QString &workingDir, const QStringList &files, const QStringList &extraOptions) { QStringList args(extraOptions); - Version v = svnVersion(); - - // --internal-diff is new in v1.7.0 - if (v.majorVersion > 1 || (v.majorVersion == 1 && v.minorVersion >= 7)) - args.append(QLatin1String("--internal-diff")); + args.append(QLatin1String("--internal-diff")); const bool hasAuth = settings()->hasAuthentication(); const QString userName = hasAuth ? settings()->stringValue(SubversionSettings::userKey) : QString(); diff --git a/src/plugins/subversion/subversionclient.h b/src/plugins/subversion/subversionclient.h index f73c03ca6a3..7b0ec2fe0f7 100644 --- a/src/plugins/subversion/subversionclient.h +++ b/src/plugins/subversion/subversionclient.h @@ -81,6 +81,8 @@ public: const QString &userName = QString(), const QString &password = QString()); + QString synchronousTopic(const QString &repository); + protected: Core::Id vcsEditorKind(VcsCommandTag cmd) const; VcsBase::VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir, diff --git a/src/plugins/subversion/subversioncontrol.cpp b/src/plugins/subversion/subversioncontrol.cpp index b2913363fe3..a69206db0ec 100644 --- a/src/plugins/subversion/subversioncontrol.cpp +++ b/src/plugins/subversion/subversioncontrol.cpp @@ -36,13 +36,35 @@ #include -using namespace Subversion; -using namespace Subversion::Internal; +namespace Subversion { +namespace Internal { + +class SubversionTopicCache : public Core::IVersionControl::TopicCache +{ +public: + SubversionTopicCache(SubversionPlugin *plugin) : + m_plugin(plugin) + { } + +protected: + QString trackFile(const QString &repository) + { + return m_plugin->monitorFile(repository); + } + + QString refreshTopic(const QString &repository) + { + return m_plugin->synchronousTopic(repository); + } + +private: + SubversionPlugin *m_plugin; +}; SubversionControl::SubversionControl(SubversionPlugin *plugin) : + Core::IVersionControl(new SubversionTopicCache(plugin)), m_plugin(plugin) -{ -} +{ } QString SubversionControl::displayName() const { @@ -153,3 +175,6 @@ void SubversionControl::emitConfigurationChanged() { emit configurationChanged(); } + +} // namespace Internal +} // namespace Subversion diff --git a/src/plugins/subversion/subversioneditor.cpp b/src/plugins/subversion/subversioneditor.cpp index 96d9db9946c..e518c30fac4 100644 --- a/src/plugins/subversion/subversioneditor.cpp +++ b/src/plugins/subversion/subversioneditor.cpp @@ -46,8 +46,8 @@ using namespace Subversion; using namespace Subversion::Internal; SubversionEditorWidget::SubversionEditorWidget() : - m_changeNumberPattern(QLatin1String("^\\d+$")), - m_revisionNumberPattern(QLatin1String("^r\\d+$")) + m_changeNumberPattern(QLatin1String("^\\s*(?(?\\d+))\\s+.*$")), + m_revisionNumberPattern(QLatin1String("\\b(?(r|[rR]evision )(?\\d+))\\b")) { QTC_ASSERT(m_changeNumberPattern.isValid(), return); QTC_ASSERT(m_revisionNumberPattern.isValid(), return); @@ -93,17 +93,33 @@ QString SubversionEditorWidget::changeUnderCursor(const QTextCursor &c) const { QTextCursor cursor = c; // Any number is regarded as change number. - cursor.select(QTextCursor::WordUnderCursor); + cursor.select(QTextCursor::LineUnderCursor); if (!cursor.hasSelection()) return QString(); QString change = cursor.selectedText(); - // Annotation output has number, log output has revision numbers - // as r1, r2... - if (m_changeNumberPattern.exactMatch(change)) - return change; - if (m_revisionNumberPattern.exactMatch(change)) { - change.remove(0, 1); - return change; + const int pos = c.position() - cursor.selectionStart() + 1; + // Annotation output has number, log output has revision numbers, + // both at the start of the line. + auto matchIter = m_changeNumberPattern.globalMatch(change); + if (!matchIter.hasNext()) + matchIter = m_revisionNumberPattern.globalMatch(change); + + // We may have several matches of our regexp and we way have + // several () in the regexp + const QString areaName = QLatin1String("area"); + while (matchIter.hasNext()) { + auto match = matchIter.next(); + const QString rev = match.captured(QLatin1String("rev")); + if (rev.isEmpty()) + continue; + + const QString area = match.captured(areaName); + QTC_ASSERT(area.contains(rev), continue); + + const int start = match.capturedStart(areaName); + const int end = match.capturedEnd(areaName); + if (pos > start && pos <= end) + return rev; } return QString(); } diff --git a/src/plugins/subversion/subversioneditor.h b/src/plugins/subversion/subversioneditor.h index 68740349942..6aacf102cdd 100644 --- a/src/plugins/subversion/subversioneditor.h +++ b/src/plugins/subversion/subversioneditor.h @@ -33,7 +33,7 @@ #include -#include +#include namespace Subversion { namespace Internal { @@ -51,8 +51,8 @@ private: VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet &changes) const; QStringList annotationPreviousVersions(const QString &) const; - mutable QRegExp m_changeNumberPattern; - mutable QRegExp m_revisionNumberPattern; + QRegularExpression m_changeNumberPattern; + QRegularExpression m_revisionNumberPattern; }; } // namespace Internal diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 9ccc89bd780..8776c50e6a0 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -504,8 +504,8 @@ bool SubversionPlugin::submitEditorAboutToClose() VcsCommand *commitCmd = m_client->createCommitCmd(m_commitRepository, fileList, m_commitMessageFileName); - QObject::connect(commitCmd, SIGNAL(success(QVariant)), - this, SLOT(cleanCommitMessageFile())); + QObject::connect(commitCmd, &VcsCommand::finished, + this, [this]() { cleanCommitMessageFile(); }); commitCmd->execute(); } } @@ -711,23 +711,6 @@ void SubversionPlugin::startCommit(const QString &workingDir, const QStringList editor->setStatusList(statusOutput); } -bool SubversionPlugin::commit(const QString &messageFile, - const QStringList &subVersionFileList) -{ - if (Subversion::Constants::debug) - qDebug() << Q_FUNC_INFO << messageFile << subVersionFileList; - // Transform the status list which is sth - // "[ADM]file" into an args list. The files of the status log - // can be relative or absolute depending on where the command was run. - QStringList args = QStringList(QLatin1String("commit")); - args << QLatin1String(Constants::NON_INTERACTIVE_OPTION) << QLatin1String("--file") << messageFile; - args.append(subVersionFileList); - const SubversionResponse response = - runSvn(m_commitRepository, args, 10 * m_settings.timeOutMs(), - SshPasswordPrompt|ShowStdOutInLogWindow); - return !response.error ; -} - void SubversionPlugin::filelogCurrentFile() { const VcsBasePluginState state = currentState(); @@ -917,10 +900,10 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) return; if (Subversion::Constants::debug) qDebug() << Q_FUNC_INFO << source << topLevel << changeNr; - // Number must be > 1 + // Number must be >= 1 bool ok; const int number = changeNr.toInt(&ok); - if (!ok || number < 2) + if (!ok || number < 1) return; // Run log to obtain message (local utf8) QString description; @@ -970,7 +953,7 @@ void SubversionPlugin::slotDescribe() QInputDialog inputDialog(ICore::dialogParent()); inputDialog.setWindowFlags(inputDialog.windowFlags() & ~Qt::WindowContextHelpButtonHint); inputDialog.setInputMode(QInputDialog::IntInput); - inputDialog.setIntRange(2, INT_MAX); + inputDialog.setIntRange(1, INT_MAX); inputDialog.setWindowTitle(tr("Describe")); inputDialog.setLabelText(tr("Revision number:")); if (inputDialog.exec() != QDialog::Accepted) @@ -1074,6 +1057,25 @@ SubversionPlugin *SubversionPlugin::instance() return m_subversionPluginInstance; } +QString SubversionPlugin::monitorFile(const QString &repository) const +{ + QTC_ASSERT(!repository.isEmpty(), return QString()); + QDir repoDir(repository); + foreach (const QString &svnDir, m_svnDirectories) { + if (repoDir.exists(svnDir)) { + QFileInfo fi(repoDir.absoluteFilePath(svnDir + QLatin1String("/wc.db"))); + if (fi.exists() && fi.isFile()) + return fi.absoluteFilePath(); + } + } + return QString(); +} + +QString SubversionPlugin::synchronousTopic(const QString &repository) const +{ + return m_client->synchronousTopic(repository); +} + bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName) { const QString file = QDir::toNativeSeparators(rawFileName); @@ -1089,8 +1091,8 @@ bool SubversionPlugin::vcsDelete(const QString &workingDir, const QString &rawFi { const QString file = QDir::toNativeSeparators(rawFileName); - QStringList args(QLatin1String("delete")); - args.push_back(file); + QStringList args; + args << QLatin1String("delete") << QLatin1String("--force") << file; const SubversionResponse response = runSvn(workingDir, args, m_settings.timeOutMs(), @@ -1178,9 +1180,6 @@ QString SubversionPlugin::vcsGetRepositoryURL(const QString &directory) bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const { const QDir dir(directory); - if (!dir.exists()) - return false; - if (topLevel) topLevel->clear(); @@ -1188,32 +1187,17 @@ bool SubversionPlugin::managesDirectory(const QString &directory, QString *topLe * furthest parent containing ".svn/wc.db". Need to check for furthest parent as closer * parents may be svn:externals. */ QDir parentDir = dir; - while (!parentDir.isRoot() && parentDir.cdUp()) { - if (checkSVNSubDir(parentDir, QLatin1String("wc.db"))) { + while (!parentDir.isRoot()) { + if (checkSVNSubDir(parentDir)) { if (topLevel) *topLevel = parentDir.absolutePath(); return true; } + if (!parentDir.cdUp()) + break; } - /* Subversion < 1.7 has ".svn" directory in each directory - * it manages. The top level is the first directory - * under the directory that does not have a ".svn".*/ - if (!checkSVNSubDir(dir)) - return false; - - if (topLevel) { - QDir lastDirectory = dir; - for (parentDir = lastDirectory; - !parentDir.isRoot() && parentDir.cdUp(); - lastDirectory = parentDir) { - if (!checkSVNSubDir(parentDir)) { - *topLevel = lastDirectory.absolutePath(); - break; - } - } - } - return true; + return false; } bool SubversionPlugin::managesFile(const QString &workingDirectory, const QString &fileName) const @@ -1226,14 +1210,14 @@ bool SubversionPlugin::managesFile(const QString &workingDirectory, const QStrin } // Check whether SVN management subdirs exist. -bool SubversionPlugin::checkSVNSubDir(const QDir &directory, const QString &fileName) const +bool SubversionPlugin::checkSVNSubDir(const QDir &directory) const { const int dirCount = m_svnDirectories.size(); for (int i = 0; i < dirCount; i++) { - const QString svnDir = directory.absoluteFilePath(m_svnDirectories.at(i)); - if (!QFileInfo(svnDir).isDir()) + const QDir svnDir(directory.absoluteFilePath(m_svnDirectories.at(i))); + if (!svnDir.exists()) continue; - if (!fileName.isEmpty() && !QDir(svnDir).exists(fileName)) + if (!svnDir.exists(QLatin1String("wc.db"))) continue; return true; } diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index e9d1ca741f0..5964794f2fe 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -91,6 +91,9 @@ public: static SubversionPlugin *instance(); + QString monitorFile(const QString &repository) const; + QString synchronousTopic(const QString &repository) const; + public slots: void vcsAnnotate(const QString &workingDir, const QString &file, const QString &revision = QString(), int lineNumber = -1); @@ -149,9 +152,8 @@ private: bool enableAnnotationContextMenu = false); void svnStatus(const QString &workingDir, const QString &relativePath = QString()); void svnUpdate(const QString &workingDir, const QString &relativePath = QString()); - bool checkSVNSubDir(const QDir &directory, const QString &fileName = QString()) const; + bool checkSVNSubDir(const QDir &directory) const; void startCommit(const QString &workingDir, const QStringList &files = QStringList()); - bool commit(const QString &messageFile, const QStringList &subVersionFileList); inline SubversionControl *subVersionControl() const; const QStringList m_svnDirectories; diff --git a/src/plugins/subversion/subversionsubmiteditor.cpp b/src/plugins/subversion/subversionsubmiteditor.cpp index 1f42371929a..7c0eddff366 100644 --- a/src/plugins/subversion/subversionsubmiteditor.cpp +++ b/src/plugins/subversion/subversionsubmiteditor.cpp @@ -55,7 +55,6 @@ void SubversionSubmitEditor::setStatusList(const QList &statusOu // Hack to allow completion in "description" field : completion needs a root repository, the // checkScriptWorkingDirectory property is fine (at this point it was set by SubversionPlugin) setFileModel(model, this->checkScriptWorkingDirectory()); - } /* diff --git a/src/plugins/todo/todoplugin.cpp b/src/plugins/todo/todoplugin.cpp index 9099ddfc62d..4922e564aee 100755 --- a/src/plugins/todo/todoplugin.cpp +++ b/src/plugins/todo/todoplugin.cpp @@ -97,7 +97,7 @@ void TodoPlugin::scanningScopeChanged(ScanningScope scanningScope) void TodoPlugin::todoItemClicked(const TodoItem &item) { - if (QFileInfo(item.file).exists()) { + if (QFileInfo::exists(item.file)) { Core::IEditor *editor = Core::EditorManager::openEditor(item.file); editor->gotoLine(item.line); } diff --git a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp index 4d3008b636c..c68b1946179 100644 --- a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp +++ b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp @@ -171,9 +171,7 @@ void CallgrindController::processFinished(int rc, QProcess::ExitStatus status) run(Dump); return; case Pause: - // on pause, reset profiling info (for now) - run(ResetEventCounters); - return; + break; case Dump: emit statusMessage(tr("Callgrind dumped profiling info")); break; diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 579a5f615cc..be13feb7e93 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -129,7 +129,7 @@ signals: public slots: void slotClear(); void slotRequestDump(); - void loadExternalXmlLogFile(); + void loadExternalLogFile(); void selectFunction(const Valgrind::Callgrind::Function *); void setCostFormat(Valgrind::Internal::CostDelegate::CostFormat format); @@ -562,11 +562,6 @@ void CallgrindTool::startTool(StartMode mode) d->setBusyCursor(true); } -void CallgrindTool::loadExternalXmlLogFile() -{ - d->loadExternalXmlLogFile(); -} - void CallgrindTool::handleShowCostsOfFunction() { d->handleShowCostsOfFunction(); @@ -662,11 +657,11 @@ QWidget *CallgrindToolPrivate::createWidgets() layout->setSpacing(0); widget->setLayout(layout); - // load external XML log file + // load external log file action = new QAction(this); action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_OPENFILE))); - action->setToolTip(tr("Load External XML Log File")); - connect(action, SIGNAL(triggered(bool)), this, SLOT(loadExternalXmlLogFile())); + action->setToolTip(tr("Load External Log File")); + connect(action, SIGNAL(triggered(bool)), this, SLOT(loadExternalLogFile())); layout->addWidget(createToolButton(action)); m_loadExternalLogFile = action; @@ -928,7 +923,7 @@ void CallgrindToolPrivate::slotRequestDump() dumpRequested(); } -void CallgrindToolPrivate::loadExternalXmlLogFile() +void CallgrindToolPrivate::loadExternalLogFile() { const QString filePath = QFileDialog::getOpenFileName( Core::ICore::mainWindow(), diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h index 4b982f094bc..73ec3ee685d 100644 --- a/src/plugins/valgrind/callgrindtool.h +++ b/src/plugins/valgrind/callgrindtool.h @@ -51,7 +51,6 @@ public: QWidget *createWidgets(); void startTool(Analyzer::StartMode mode); - void loadExternalXmlLogFile(); public slots: void handleShowCostsOfFunction(); diff --git a/src/plugins/valgrind/valgrindprocess.cpp b/src/plugins/valgrind/valgrindprocess.cpp index b4a1534a052..28f655b49d3 100644 --- a/src/plugins/valgrind/valgrindprocess.cpp +++ b/src/plugins/valgrind/valgrindprocess.cpp @@ -310,7 +310,8 @@ void ValgrindProcess::findPIDOutputReceived() QString ValgrindProcess::argumentString(Utils::OsType osType) const { QString arguments = Utils::QtcProcess::joinArgs(m_valgrindArguments, osType); - Utils::QtcProcess::addArg(&arguments, m_debuggeeExecutable, osType); + if (!m_debuggeeExecutable.isEmpty()) + Utils::QtcProcess::addArg(&arguments, m_debuggeeExecutable, osType); Utils::QtcProcess::addArgs(&arguments, m_debuggeeArguments); return arguments; } diff --git a/src/plugins/welcome/welcome.qbs b/src/plugins/welcome/welcome.qbs index c44fbb89656..9b880013485 100644 --- a/src/plugins/welcome/welcome.qbs +++ b/src/plugins/welcome/welcome.qbs @@ -4,7 +4,6 @@ import QtcPlugin QtcPlugin { name: "Welcome" - minimumQtVersion: "5.1" Depends { name: "Qt"; submodules: ["widgets", "network"] } Depends { name: "Qt.quick"; condition: product.condition; } diff --git a/src/plugins/winrt/winrt.qbs b/src/plugins/winrt/winrt.qbs index 67b8e0e4bf5..8e657c66f86 100644 --- a/src/plugins/winrt/winrt.qbs +++ b/src/plugins/winrt/winrt.qbs @@ -4,7 +4,6 @@ import QtcPlugin QtcPlugin { name: "WinRt" - minimumQtVersion: "5.0" Depends { name: "Core" } Depends { name: "Debugger" } diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.cpp b/src/plugins/winrt/winrtpackagedeploymentstep.cpp index 51f0315ac09..71f902d66e0 100644 --- a/src/plugins/winrt/winrtpackagedeploymentstep.cpp +++ b/src/plugins/winrt/winrtpackagedeploymentstep.cpp @@ -78,8 +78,7 @@ bool WinRtPackageDeploymentStep::init() m_targetFilePath = appTargetFilePath.toString(); if (m_targetFilePath.isEmpty()) { - // ### raise error in 3.3 - // raiseError(tr("No executable to deploy found in %1.").arg(rc->proFilePath())); + raiseError(tr("No executable to deploy found in %1.").arg(rc->proFilePath())); return false; } @@ -99,21 +98,31 @@ bool WinRtPackageDeploymentStep::init() QString args = QtcProcess::quoteArg(QDir::toNativeSeparators(m_targetFilePath)); args += QLatin1Char(' ') + m_args; - m_manifestFileName = QStringLiteral("AppxManifest"); - if (qt->type() == QLatin1String(Constants::WINRT_WINPHONEQT)) { m_createMappingFile = true; - if (qt->mkspec().toString().contains(QLatin1String("msvc2012"))) - m_manifestFileName = QStringLiteral("WMAppManifest"); + args += QLatin1String(" -list mapping"); } + ProcessParameters *params = processParameters(); + params->setCommand(QLatin1String("windeployqt.exe")); + params->setArguments(args); + params->setEnvironment(target()->activeBuildConfiguration()->environment()); + + return AbstractProcessStep::init(); +} + +void WinRtPackageDeploymentStep::run(QFutureInterface &fi) +{ + AbstractProcessStep::run(fi); + + const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit()); + if (!qt) + return; + + m_manifestFileName = QStringLiteral("AppxManifest"); + if (m_createMappingFile) { - args += QLatin1String(" -list mapping"); m_mappingFileContent = QLatin1String("[Files]\n"); - if (qt->mkspec().toString().contains(QLatin1String("msvc2012"))) { - m_mappingFileContent += QLatin1Char('"') + QDir::toNativeSeparators(m_targetDirPath) + m_manifestFileName - + QLatin1String(".xml\" \"") + m_manifestFileName + QLatin1String(".xml\"\n"); - } QDir assetDirectory(m_targetDirPath + QLatin1String("assets")); if (assetDirectory.exists()) { @@ -123,7 +132,7 @@ bool WinRtPackageDeploymentStep::init() if (!parseIconsAndExecutableFromManifest(fullManifestPath, &iconsToDeploy, &m_executablePathInManifest)) { raiseError(tr("Cannot parse manifest file %1.").arg(fullManifestPath)); - return false; + return; } foreach (const QString &icon, iconsToDeploy) { m_mappingFileContent += QLatin1Char('"') @@ -132,13 +141,6 @@ bool WinRtPackageDeploymentStep::init() } } } - - ProcessParameters *params = processParameters(); - params->setCommand(QLatin1String("windeployqt.exe")); - params->setArguments(args); - params->setEnvironment(target()->activeBuildConfiguration()->environment()); - - return AbstractProcessStep::init(); } bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitStatus status) @@ -160,8 +162,8 @@ bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitSt installableFilesList.append(QPair(localFilePath, remoteFilePath)); } - // if there are no INSTALLS set we just deploy the files from windeployqt, the manifest (in case of 2012) - // and the icons referenced in there and the actual build target + // if there are no INSTALLS set we just deploy the files from windeployqt, + // the icons referenced in the manifest file and the actual build target QString baseDir; if (targetInstallationPath.isEmpty()) { if (!m_targetFilePath.endsWith(QLatin1String(".exe"))) @@ -185,24 +187,8 @@ bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitSt relativeRemotePath = QDir(baseDir).relativeFilePath(pair.second); if (QDir(relativeRemotePath).isAbsolute() || relativeRemotePath.startsWith(QLatin1String(".."))) { - // special case for winphone 8.0 font deployment - const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit()); - if (!qt) - return false; - if (qt->mkspec().toString().contains(QLatin1String("msvc2012"))) { - const QString fileName = relativeRemotePath.mid(relativeRemotePath.lastIndexOf(QLatin1Char('/')) + 1); - if (QFile::exists(m_targetDirPath + QLatin1String("fonts/") + fileName)) { - relativeRemotePath = QLatin1String("fonts/") + fileName; - } else { - // for 3.3? - // raiseWarning(tr("File %1 is outside of the executable's directory. These files cannot be installed.").arg(relativeRemotePath)); - continue; - } - } else { - // for 3.3? - // raiseWarning(tr("File %1 is outside of the executable's directory. These files cannot be installed.").arg(relativeRemotePath)); - continue; - } + raiseWarning(tr("File %1 is outside of the executable's directory. These files cannot be installed.").arg(relativeRemotePath)); + continue; } m_mappingFileContent += QLatin1Char('"') + QDir::toNativeSeparators(pair.first) @@ -260,6 +246,13 @@ void WinRtPackageDeploymentStep::raiseError(const QString &errorMessage) ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT)); } +void WinRtPackageDeploymentStep::raiseWarning(const QString &warningMessage) +{ + emit addOutput(warningMessage, BuildStep::MessageOutput); + emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Warning, warningMessage, Utils::FileName(), -1, + ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT)); +} + bool WinRtPackageDeploymentStep::fromMap(const QVariantMap &map) { if (!AbstractProcessStep::fromMap(map)) diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.h b/src/plugins/winrt/winrtpackagedeploymentstep.h index 47aa29fec03..01fbed2234f 100644 --- a/src/plugins/winrt/winrtpackagedeploymentstep.h +++ b/src/plugins/winrt/winrtpackagedeploymentstep.h @@ -42,6 +42,7 @@ class WinRtPackageDeploymentStep : public ProjectExplorer::AbstractProcessStep public: explicit WinRtPackageDeploymentStep(ProjectExplorer::BuildStepList *bsl); bool init(); + void run(QFutureInterface &fi); bool processSucceeded(int exitCode, QProcess::ExitStatus status); void stdOutput(const QString &line); ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); @@ -51,6 +52,7 @@ public: QString defaultWinDeployQtArguments() const; void raiseError(const QString &errorMessage); + void raiseWarning(const QString &warningMessage); bool fromMap(const QVariantMap &map); QVariantMap toMap() const; diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index dfd7d5dcb76..8252e4ba2cb 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -102,7 +102,7 @@ QString ProFileEvaluator::sysrootify(const QString &path, const QString &baseDir const bool isHostSystemPath = option->sysroot.isEmpty() || path.startsWith(option->sysroot, cs) || path.startsWith(baseDir, cs) || path.startsWith(d->m_outputDir, cs) - || !QFileInfo(option->sysroot + path).exists(); + || !QFileInfo::exists(option->sysroot + path); return isHostSystemPath ? path : option->sysroot + path; } diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 1190b0afce4..6239816ed7c 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -1895,7 +1895,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile( } #ifdef QMAKE_BUILTIN_PRFS fn.prepend(QLatin1String(":/qmake/features/")); - if (QFileInfo(fn).exists()) + if (QFileInfo::exists(fn)) goto cool; #endif fn = QLatin1String(""); // Indicate failed lookup. See comment above. diff --git a/src/shared/qbs b/src/shared/qbs index eda76354077..0d1b18c7ad5 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit eda76354077a427d692fee05479910de31040d3f +Subproject commit 0d1b18c7ad5bbfe4507f33d5f726b46f39d08677 diff --git a/src/tools/3rdparty/iossim/iphonesimulator.mm b/src/tools/3rdparty/iossim/iphonesimulator.mm index 38b7bb207ea..d573808f105 100644 --- a/src/tools/3rdparty/iossim/iphonesimulator.mm +++ b/src/tools/3rdparty/iossim/iphonesimulator.mm @@ -458,8 +458,9 @@ static void ChildSignal(int /*arg*/) { appSpec = startOnly ? nil : [[self FindClassByName:@"DTiPhoneSimulatorApplicationSpecifier"] specifierWithApplicationPath:path]; if (verbose) { - msgprintf(@"App Spec: %@", appSpec); - msgprintf(@"SDK Root: %@", sdkRoot); + msgprintf(@"App Spec: %@\n", appSpec); + msgprintf(@"SDK Root: %@\n", sdkRoot); + msgprintf(@"SDK Version: %@\n", [sdkRoot sdkVersion]); for (id key in environment) { msgprintf(@"Env: %@ = %@", key, [environment objectForKey:key]); diff --git a/src/tools/3rdparty/iossim_1_8_2/iphonesimulator.mm b/src/tools/3rdparty/iossim_1_8_2/iphonesimulator.mm index 141393ea03f..a7ab822cddf 100644 --- a/src/tools/3rdparty/iossim_1_8_2/iphonesimulator.mm +++ b/src/tools/3rdparty/iossim_1_8_2/iphonesimulator.mm @@ -491,7 +491,7 @@ NSString *deviceIpadRetina = @"iPad (Retina)"; } else if (strcmp(argv[i], "--env") == 0) { i++; NSString *envFilePath = [[NSString stringWithUTF8String:argv[i]] expandPath]; - environment = [NSDictionary dictionaryWithContentsOfFile:envFilePath]; + environment = [NSMutableDictionary dictionaryWithContentsOfFile:envFilePath]; if (!environment) { fprintf(stdout, "Could not read environment from file: %s\n", argv[i]); [self printUsage]; diff --git a/src/tools/sdktool/operation.cpp b/src/tools/sdktool/operation.cpp index 1f0bfb1888c..384f329da8e 100644 --- a/src/tools/sdktool/operation.cpp +++ b/src/tools/sdktool/operation.cpp @@ -102,7 +102,7 @@ QVariantMap Operation::load(const QString &file) // Read values from original file: Utils::FileName path = Settings::instance()->getPath(file); - if (path.toFileInfo().exists()) { + if (path.exists()) { Utils::PersistentSettingsReader reader; if (!reader.load(path)) return QVariantMap(); diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index e01688e6d6c..d7d869a6174 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -175,7 +175,9 @@ void dummyStatement(...) {} #include #include #include -#include +# if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) +# include +# endif #endif #if USE_SCRIPTLIB @@ -718,10 +720,12 @@ namespace qdatetime { void testQTimeZone() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) QTimeZone zz; QTimeZone tz("UTC+05:00"); BREAK_HERE; dummyStatement(&zz, &tz); +#endif } void testQDate() @@ -3258,9 +3262,11 @@ namespace stdmap { void testStdMultiSetInt() { +#ifndef Q_CC_MSVC std::multiset set = {1, 1, 2, 3, 3, 3}; BREAK_HERE; dummyStatement(&set); +#endif } void testStdMap() @@ -5522,11 +5528,13 @@ namespace basic { void testLongEvaluation1() { - QTimeZone tz("UTC+05:00"); QDateTime time = QDateTime::currentDateTime(); const int N = 10000; QDateTime x = time; +#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) + QTimeZone tz("UTC+05:00"); x.setTimeZone(tz); +#endif QDateTime bigv[N]; for (int i = 0; i < 10000; ++i) { bigv[i] = time; diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py index 20ec919ebeb..28b038a3326 100644 --- a/tests/system/shared/classes.py +++ b/tests/system/shared/classes.py @@ -30,8 +30,6 @@ import operator -isQt4Build = False - # for easier re-usage (because Python hasn't an enum type) class Targets: DESKTOP_474_GCC = 1 @@ -107,10 +105,7 @@ class ProjectSettings: # this class defines some constants for the views of the creator's MainWindow class ViewConstants: - if isQt4Build: - EDIT, DESIGN, DEBUG, PROJECTS, ANALYZE, HELP = range(6) - else: - WELCOME, EDIT, DESIGN, DEBUG, PROJECTS, ANALYZE, HELP = range(7) + WELCOME, EDIT, DESIGN, DEBUG, PROJECTS, ANALYZE, HELP = range(7) FIRST_AVAILABLE = 0 # always adjust the following to the highest value of the available ViewConstants when adding new LAST_AVAILABLE = HELP @@ -120,7 +115,7 @@ class ViewConstants: # if the provided argument does not match any of the ViewConstants it returns None @staticmethod def getToolTipForViewTab(viewTab): - if not isQt4Build and viewTab == ViewConstants.WELCOME: + if viewTab == ViewConstants.WELCOME: toolTip = ur'Switch to Welcome mode (Ctrl\+|\u2303)%d' elif viewTab == ViewConstants.EDIT: toolTip = ur'Switch to Edit mode (Ctrl\+|\u2303)%d' diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index eac88739e87..54f3f99a70d 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -317,7 +317,7 @@ def createNewQmlExtension(workingDir, targets=Targets.DESKTOP_474_GCC, qtQuickVe return checkedTargets def createEmptyQtProject(workingDir=None, projectName=None, targets=Targets.desktopTargetClasses()): - __createProjectOrFileSelectType__(" Other Project", "Empty Qt Project") + __createProjectOrFileSelectType__(" Other Project", "Empty qmake Project") if workingDir == None: workingDir = tempDir() projectName = __createProjectSetNameAndPath__(workingDir, projectName) diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index bf1f33fea4a..9bd51b901e9 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -72,7 +72,7 @@ def overrideStartApplication(): if platform.system() == 'Darwin': args[0] = args[0].replace('qtcreator', '"Qt Creator"', 1) test.log("Using workaround for MacOS (different AUT name)") - elif not isQt4Build: + else: args[0] = args[0] + ' -platform windows:dialogs=none' test.log("Using workaround for Windows (failing to hook into native FileDialog)") return __origStartApplication__(*args) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 53668b16583..8d785611900 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -203,7 +203,7 @@ def invokeMenuItem(menu, item, *subItems): except: nativeMouseClick(waitForObject(":Qt Creator_Core::Internal::MainWindow", 1000), 20, 20, 0, Qt.LeftButton) # HACK to avoid squish crash using Qt5.2 on Squish 5.0.1 - remove asap - if platform.system() == "Darwin" and not isQt4Build: + if platform.system() == "Darwin": if menu == "Tools" and item == "Options...": nativeType("") return diff --git a/tests/system/shared_data/qt_squish_mapping.tsv b/tests/system/shared_data/qt_squish_mapping.tsv index 8f2202f5743..00dbfcf9f6e 100644 --- a/tests/system/shared_data/qt_squish_mapping.tsv +++ b/tests/system/shared_data/qt_squish_mapping.tsv @@ -1,28 +1,4 @@ "squishversion" "qtversion" "mkspec" "path" -"4.1" "4.7" "win32-g++" "C:\QtSDK\src\creator-test-data\Squish_MinGW" -"4.1" "4.7" "win32-msvc2008" "C:\QtSDK\src\creator-test-data\Squish_MSVC9" -"4.1" "4.7" "win32-msvc-2010" "C:\QtSDK\src\creator-test-data\Squish_MSVC10" -"4.1" "4.7" "linux-g++" "~/QtSDK/src/creator-test-data/Squish_32" -"4.1" "4.7" "linux-g++-64" "~/QtSDK/src/creator-test-data/Squish_64" -"4.1" "4.7" "macx-g++" "~/QtSDK/src/creator-test-data/Squish_47x" -"4.1" "4.8" "win32-g++" "C:\QtSDK\src\creator-test-data\Squish_MinGW" -"4.1" "4.8" "win32-msvc2008" "C:\QtSDK\src\creator-test-data\Squish_MSVC9" -"4.1" "4.8" "win32-msvc-2010" "C:\QtSDK\src\creator-test-data\Squish_MSVC10" -"4.1" "4.8" "linux-g++" "~/QtSDK/src/creator-test-data/Squish_32" -"4.1" "4.8" "linux-g++-64" "~/QtSDK/src/creator-test-data/Squish_64" -"4.1" "4.8" "macx-g++" "~/QtSDK/src/creator-test-data/Squish_47x" -"4.2" "4.7" "win32-g++" "C:\QtSDK\src\creator-test-data\Squish4.2_MinGW" -"4.2" "4.7" "win32-msvc2008" "C:\QtSDK\src\creator-test-data\Squish4.2_MSVC9" -"4.2" "4.7" "win32-msvc2010" "C:\QtSDK\src\creator-test-data\Squish4.2_MSVC10" -"4.2" "4.7" "linux-g++" "~/QtSDK/src/creator-test-data/Squish4.2_32" -"4.2" "4.7" "linux-g++-64" "~/QtSDK/src/creator-test-data/Squish4.2_64" -"4.2" "4.7" "macx-g++" "~/QtSDK/src/creator-test-data/Squish4.2_Mac" -"4.2" "4.8" "win32-g++" "C:\QtSDK\src\creator-test-data\Squish4.2_MinGW" -"4.2" "4.8" "win32-msvc2008" "C:\QtSDK\src\creator-test-data\Squish4.2_MSVC9" -"4.2" "4.8" "win32-msvc2010" "C:\QtSDK\src\creator-test-data\Squish4.2_MSVC10" -"4.2" "4.8" "linux-g++" "~/QtSDK/src/creator-test-data/Squish4.2_32" -"4.2" "4.8" "linux-g++-64" "~/QtSDK/src/creator-test-data/Squish4.2_64" -"4.2" "4.8" "macx-g++" "~/QtSDK/src/creator-test-data/Squish4.2_Mac" "5.0" "4.7" "macx-g++" "~/QtSDK/src/creator-test-data/Squish5_47_Mac" "5.0" "4.7" "linux-g++" "~/QtSDK/src/creator-test-data/Squish5_47_Linux32" "5.0" "4.7" "linux-g++-64" "~/QtSDK/src/creator-test-data/Squish5_47_Linux64" diff --git a/tests/system/suite_HELP/tst_HELP02/test.py b/tests/system/suite_HELP/tst_HELP02/test.py index 71044ada687..1d7d2869195 100755 --- a/tests/system/suite_HELP/tst_HELP02/test.py +++ b/tests/system/suite_HELP/tst_HELP02/test.py @@ -63,7 +63,7 @@ def checkQtCreatorHelpVersion(expectedVersion): 'Qt Creator Manual %s' % expectedVersion, 'Verifying whether manual uses expected version.') except: - test.fail("Missing Qt Creator Manual.") + test.xverify(False, "Missing Qt Creator Manual (QTCREATORBUG-13233).") def setKeyboardShortcutForAboutQtC(): invokeMenuItem("Tools", "Options...") diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index dcaf622afa3..ea3145d2e33 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -59,8 +59,6 @@ def __getUrl__(): url = helpViewer.source except: return "" - if isQt4Build: - return str(url.toString()) return str(url.scheme) + "://" + str(url.host) + str(url.path) def getHighlightsInHtml(htmlCode): @@ -72,6 +70,13 @@ def getHighlightsInHtml(htmlCode): res += "%s " % curr.group(1) return res +def verifySelection(expected): + selText = str(__getSelectedText__()) + if test.verify(selText, "Verify that there is a selection"): + # verify if search keyword is found in results + test.verify(expected.lower() in selText.lower(), + "'%s' search result can be found" % expected) + def main(): global sdkPath noMatch = "Your search did not match any documents." @@ -116,9 +121,7 @@ def main(): type(waitForObject(":Hits_QCLuceneResultWidget"), "") type(waitForObject(":Hits_QCLuceneResultWidget"), "") waitFor("__getUrl__() != url or selText != __getSelectedText__()", 20000) - # verify if search keyword is found in results - test.verify(searchKeyword.lower() in __getSelectedText__().lower(), - searchKeyword + " search result can be found") + verifySelection(searchKeyword) else: test.verify(waitFor("noMatch in " "str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 1000), @@ -149,13 +152,11 @@ def main(): mouseClick(resultsView, 1, 1, 0, Qt.LeftButton) type(resultsView, "") type(resultsView, "") - test.verify("printing" in str(__getSelectedText__()).lower(), - "printing advanced search result can be found") + verifySelection("printing") for i in range(2): type(resultsView, "") type(resultsView, "") - test.verify("sql" in str(__getSelectedText__()).lower(), - "sql advanced search result can be found") + verifySelection("sql") # verify if simple search is properly disabled test.verify(not searchLineEdit.enabled, "Verifying if simple search is not active in advanced mode.") diff --git a/tests/system/suite_HELP/tst_HELP06/test.py b/tests/system/suite_HELP/tst_HELP06/test.py index 7aeca3b5435..963aef225fc 100755 --- a/tests/system/suite_HELP/tst_HELP06/test.py +++ b/tests/system/suite_HELP/tst_HELP06/test.py @@ -45,10 +45,7 @@ def invokeContextMenuItemOnBookmarkFolder(view, item, menuItem): "window=':Add Bookmark_BookmarkDialog'}" % aboveWidget), menuItem) def textForQtVersion(text): - if isQt4Build: - return "QtCreator : " + text - else: - return text + " | QtCreator" + return text + " | QtCreator" def main(): startApplication("qtcreator" + SettingsPath) diff --git a/tests/system/suite_WELP/tst_WELP01/test.py b/tests/system/suite_WELP/tst_WELP01/test.py index 26ecfda5439..5520439fe98 100755 --- a/tests/system/suite_WELP/tst_WELP01/test.py +++ b/tests/system/suite_WELP/tst_WELP01/test.py @@ -58,8 +58,8 @@ def waitForButtonsState(projectsChecked, examplesChecked, tutorialsChecked, time 'and tutoButton.checked == tutorialsChecked', timeout) def main(): - if isQt4Build or not canTestEmbeddedQtQuick(): - test.log("Welcome mode is not available or not scriptable with this Squish version") + if not canTestEmbeddedQtQuick(): + test.log("Welcome mode is not scriptable with this Squish version") return global gettingStartedText # open Qt Creator diff --git a/tests/system/suite_WELP/tst_WELP02/test.py b/tests/system/suite_WELP/tst_WELP02/test.py index 3eeb8e50623..f2ef28686ce 100644 --- a/tests/system/suite_WELP/tst_WELP02/test.py +++ b/tests/system/suite_WELP/tst_WELP02/test.py @@ -39,8 +39,8 @@ def checkTypeAndProperties(typePropertiesDetails): "Verifying: Qt Creator displays %s." % detail) def main(): - if isQt4Build or not canTestEmbeddedQtQuick(): - test.log("Welcome mode is not available or not scriptable with this Squish version") + if not canTestEmbeddedQtQuick(): + test.log("Welcome mode is not scriptable with this Squish version") return # prepare example project sourceExample = os.path.join(sdkPath, "Examples", "4.7", "declarative", "animation", "basics", diff --git a/tests/system/suite_WELP/tst_WELP03/test.py b/tests/system/suite_WELP/tst_WELP03/test.py index bdb76eb8067..33819b105cd 100644 --- a/tests/system/suite_WELP/tst_WELP03/test.py +++ b/tests/system/suite_WELP/tst_WELP03/test.py @@ -73,8 +73,8 @@ def handlePackagingMessageBoxes(): break def main(): - if isQt4Build or not canTestEmbeddedQtQuick(): - test.log("Welcome mode is not available or not scriptable with this Squish version") + if not canTestEmbeddedQtQuick(): + test.log("Welcome mode is not scriptable with this Squish version") return global sdkPath # open Qt Creator diff --git a/tests/system/suite_WELP/tst_WELP04/test.py b/tests/system/suite_WELP/tst_WELP04/test.py index 749a481572d..206dace3ec0 100644 --- a/tests/system/suite_WELP/tst_WELP04/test.py +++ b/tests/system/suite_WELP/tst_WELP04/test.py @@ -32,8 +32,8 @@ source("../../shared/qtcreator.py") source("../../shared/suites_qtta.py") def main(): - if isQt4Build or not canTestEmbeddedQtQuick(): - test.log("Welcome mode is not available or not scriptable with this Squish version") + if not canTestEmbeddedQtQuick(): + test.log("Welcome mode is not scriptable with this Squish version") return # open Qt Creator startApplication("qtcreator" + SettingsPath) diff --git a/tests/system/suite_debugger/tst_simple_analyze/test.py b/tests/system/suite_debugger/tst_simple_analyze/test.py index 92ec0354f82..aec5fddea3f 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/test.py +++ b/tests/system/suite_debugger/tst_simple_analyze/test.py @@ -31,9 +31,6 @@ source("../../shared/qtcreator.py") def main(): - if isQt4Build: - test.log("QML Profiler is only available if Creator was built on Qt 5") - return startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return diff --git a/tests/system/suite_editors/tst_select_all/test.py b/tests/system/suite_editors/tst_select_all/test.py index fef16bdb8d4..7ea51d2cfdc 100644 --- a/tests/system/suite_editors/tst_select_all/test.py +++ b/tests/system/suite_editors/tst_select_all/test.py @@ -70,11 +70,7 @@ def main(): else: pos = size if key == "": - if not isQt4Build or platform.system() == "Darwin": - # native cursor behavior on Mac is different in Qt4 - pos = 0 - else: - pos -= 1 + pos = 0 test.compare(editor.textCursor().selectionStart(), pos) test.compare(editor.textCursor().selectionEnd(), pos) test.compare(editor.textCursor().position(), pos) diff --git a/tests/system/suite_general/tst_opencreator_qbs/test.py b/tests/system/suite_general/tst_opencreator_qbs/test.py index f58800323d9..c40cdcf6ca4 100644 --- a/tests/system/suite_general/tst_opencreator_qbs/test.py +++ b/tests/system/suite_general/tst_opencreator_qbs/test.py @@ -31,9 +31,6 @@ source("../../shared/qtcreator.py") def main(): - if isQt4Build: - test.log("QbsProjectManager is not available with Qt4") - return pathCreator = os.path.join(srcPath, "creator", "qtcreator.qbs") if not neededFilePresent(pathCreator): return diff --git a/tests/system/suite_general/tst_rename_file/test.py b/tests/system/suite_general/tst_rename_file/test.py index c61ae7b157d..79915e88906 100644 --- a/tests/system/suite_general/tst_rename_file/test.py +++ b/tests/system/suite_general/tst_rename_file/test.py @@ -52,13 +52,6 @@ def main(): ["Resources", "musicbrowser.qrc"], ["QML", "musicbrowser.qml"]]: filenames = ["ABCD" + filename.upper(), "abcd" + filename.lower(), "test", "TEST", filename] - if isQt4Build and platform.system() == 'Darwin': - # avoid QTCREATORBUG-9197 - filtered = [filenames[0]] - for filename in filenames[1:]: - if filename.lower() != filtered[-1].lower(): - filtered.append(filename) - filenames = filtered previous = filenames[-1] for filename in filenames: tempFiletype = filetype diff --git a/tests/system/suite_general/tst_session_handling/test.py b/tests/system/suite_general/tst_session_handling/test.py index c199abe0d3e..43827067f16 100644 --- a/tests/system/suite_general/tst_session_handling/test.py +++ b/tests/system/suite_general/tst_session_handling/test.py @@ -42,7 +42,7 @@ def main(): mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow") test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000), "Verifying window title contains created session name.") - if not isQt4Build and canTestEmbeddedQtQuick(): + if canTestEmbeddedQtQuick(): checkWelcomePage(sessionName, True) for project in projects: openQmakeProject(project, Targets.DESKTOP_480_GCC) @@ -55,7 +55,7 @@ def main(): switchSession("default") test.verify(waitFor("'Qt Creator' == str(mainWindow.windowTitle)", 2000), "Verifying window title is set to default.") - if not isQt4Build and canTestEmbeddedQtQuick(): + if canTestEmbeddedQtQuick(): checkWelcomePage(sessionName, False) switchViewTo(ViewConstants.EDIT) checkNavigator(1, "Verifying that no more project is opened.")