diff options
136 files changed, 1523 insertions, 850 deletions
diff --git a/README.md b/README.md index bef59ad6c74..d195cbf6790 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Prerequisites: * jom * On Mac OS X: latest Xcode * On Linux: g++ 4.8 or later +* LLVM 3.8.0 or later for the Clang Code Model The installed toolchains have to match the one Qt was compiled with. @@ -114,7 +115,7 @@ For detailed information on the supported compilers, see command...` error. If a `sh.exe` is found, the compile process will fail. You have to remove it from the path. - 10. To enable the Clang-based code model: Install Clang (>= version 3.6.2) + 10. To enable the Clang-based code model: Install Clang (>= version 3.8.0) and set the environment variable LLVM_INSTALL_DIR to point to the installation location. diff --git a/dist/changes-4.1.0.md b/dist/changes-4.1.0.md new file mode 100644 index 00000000000..ce25b28dfe0 --- /dev/null +++ b/dist/changes-4.1.0.md @@ -0,0 +1,195 @@ +Qt Creator version 4.1 contains bug fixes and new features. + +The most important changes are listed in this document. For a complete +list of changes, see the Git log for the Qt Creator sources that +you can check out from the public Git repository. For example: + + git clone git://code.qt.io/qt-creator/qt-creator.git + git log --cherry-pick --pretty=oneline origin/4.0..v4.1.0 + +General + +* Added `Flat Dark` and `Flat Light` themes +* Added `Ctrl+N` and `Ctrl+P` shortcuts for navigating in Locator +* Added experimental support for the `Nim` programming language + +Editing + +* Added automatic release of resources for unmodified documents that have + not been visible a long time (QTCREATORBUG-10016) +* Added separate options for automatically inserted characters +* Added highlighting of automatically inserted characters +* Added option for skipping automatically inserted character, and changed + it to do this only as long as the cursor stays before it +* Fixed that replacing could change the selection (QTCREATORBUG-15623) + +All Projects + +* Improved feedback when build results in errors and there + are issues with the kit (QTCREATORBUG-16079) +* Fixed issue with building in paths with non-ASCII characters + (QTCREATORBUG-15855) +* Fixed that `%{buildDir}` and `%{sourceDir}` stopped working in + run configurations (QTCREATORBUG-16338) + +QMake Projects + +* Added `Duplicate File` to context menu in project tree (QTCREATORBUG-15952) +* Added `QtWebEngine` to modules list +* Changed `Run Qmake` from `qmake -r` to `qmake && make qmake_all` for Qt 5 +* Fixed renaming files used in QRC files (QTCREATORBUG-15786) + +CMake Projects + +* Improved parsing of errors +* Added workaround for CMake issue that include paths are in random order + (QTCREATORBUG-16432) +* Added option for disabling automatic running of CMake to Build & Run > CMake + (QTCREATORBUG-15934) +* Fixed that CMake was automatically run even if the Qt Creator application + is not in the foreground (QTCREATORBUG-16354) + +Qbs Projects + +* Added support for `qtcRunnable` property, similar to `qtc_runnable` for + Qmake projects + +C++ Support + +* Added separate highlighting for function declarations and usages + (QTCREATORBUG-15564) +* Added highlighting option for global variables +* Added coding style option for preferring getters with `get` +* Fixed parsing of `-std=gnu++XX` option (QTCREATORBUG-16290) +* Fixed refactoring of methods with ref-qualifier + +QML Support + +* Added formal parameters of JavaScript functions to outline and Locator + +Debugging + +* Added support for copying selected values from `Locals and Expressions` + (QTCREATORBUG-14956) +* Fixed jumping to address in binary editor (QTCREATORBUG-11064) +* GDB + * Fixed that `qint8` values where shown as unsigned values + (QTCREATORBUG-16353) + +QML Profiler + +* Improved progress information +* Improved performance when many events are involved + +Qt Quick Designer + +* Added support for Qt Quick Controls 2 styles +* Added `Move to Component` action +* Added `Add new Signal Handler` action +* Improved performance +* Improved error dialog (QTCREATORBUG-15772) +* Fixed crumble bar for component navigation +* Fixed that `Connections` was not allowed in `.ui.qml` files +* Fixed crashes with spaces in properties (QTCREATORBUG-16059) +* Fixed that child items of `State` were rendered (QTCREATORBUG-13003) + +Version Control Systems + +* Git + * Added date and time information to branch dialog + * Added support for running `git blame` only on selected lines + (QTCREATORBUG-16055) + * Fixed that branch dialog suggested existing branch name for new branch + (QTCREATORBUG-16264) +* SVN + * Added conflicted files to file list in submit editor + +Test Integration + +* Fixed that test case summary stayed visible even if no entries matched + the applied filter +* Fixed parsing of failure location for Google Test on Windows + +FakeVim + +* Added expansion of `~` in file names (QTCREATORBUG-11160) + +Model Editor + +* Added zooming of diagrams + +Beautifier + +* Added option to automatically format files on save +* Uncrustify + * Fixed issues with non-C++ files (QTCREATORBUG-15575) + +Platform Specific + +Windows + +* Added detection of MSVC amd64_x86 toolchain + +macOS + +* Fixed include search order with frameworks (QTCREATORBUG-11599) + +Remote Linux + +* Added support for TCP/IP forward tunneling with SSH + +iOS + +* Fixed that deployment could fail if device and host are in same WiFi network + (QTCREATORBUG-16061) +* Fixed missing human readable error messages (QTCREATORBUG-16328) + +Credits for these changes go to: +Albert Astals Cid +Alessandro Portale +Alexander Drozdov +Andre Hartmann +André Pönitz +Antoine Poliakov +Arnold Dumas +BogDan Vatra +Christian Kandeler +Christian Stenger +Cristian Adam +David Schulz +Dmitry Ashkadov +Eike Ziller +Erik Verbrüggen +Filippo Cucchetto +Finn Brudal +Georger Araújo +Jake Petroules +Jaroslaw Kobus +Jean Gressmann +Jochen Becher +Leena Miettinen +Lorenz Haas +Lukas Holecek +Marco Benelli +Marco Bubke +Marc Reilly +Mashrab Kuvatov +Maurice Kalinowski +Nikita Baryshnikov +Nikolai Kosjar +Orgad Shaneh +Oswald Buddenhagen +Philip Lorenz +Robert Löhning +Shinnok +Takumi ASAKI +Thiago Macieira +Thomas Hartmann +Tim Jenssen +Tobias Hunger +Ulf Hermann +Unai IRIGOYEN +Victor Heng +Vikas Pachdha +Vlad Seryakov +Wolfgang Bremer diff --git a/doc/src/editors/creator-clang-codemodel.qdoc b/doc/src/editors/creator-clang-codemodel.qdoc index 82893b7bf44..95ceccd083a 100644 --- a/doc/src/editors/creator-clang-codemodel.qdoc +++ b/doc/src/editors/creator-clang-codemodel.qdoc @@ -103,7 +103,7 @@ \list 1 - \li Acquire Clang 3.6.2 or higher in one of the following ways: + \li Acquire Clang 3.8.0 or higher in one of the following ways: \list diff --git a/qbs/imports/QtcPlugin.qbs b/qbs/imports/QtcPlugin.qbs index c81d2bdf142..7e2488eb49c 100644 --- a/qbs/imports/QtcPlugin.qbs +++ b/qbs/imports/QtcPlugin.qbs @@ -25,7 +25,7 @@ QtcProduct { name: "Qt.test" } - cpp.createSymlinks: false + cpp.internalVersion: "" cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"]) cpp.sonamePrefix: qbs.targetOS.contains("osx") ? "@rpath" diff --git a/qbs/modules/libclang/functions.js b/qbs/modules/libclang/functions.js index daa240b8532..e09ebef1ee5 100644 --- a/qbs/modules/libclang/functions.js +++ b/qbs/modules/libclang/functions.js @@ -1,6 +1,6 @@ var Environment = loadExtension("qbs.Environment") var File = loadExtension("qbs.File") -var MinimumLLVMVersion = "3.6.2" +var MinimumLLVMVersion = "3.8.0" var Process = loadExtension("qbs.Process") function readOutput(executable, args) @@ -27,8 +27,7 @@ function llvmConfig(qbs, qtcFunctions) { var llvmInstallDirFromEnv = Environment.getEnv("LLVM_INSTALL_DIR") var llvmConfigVariants = [ - "llvm-config", "llvm-config-3.2", "llvm-config-3.3", "llvm-config-3.4", - "llvm-config-3.5", "llvm-config-3.6", "llvm-config-4.0", "llvm-config-4.1" + "llvm-config", "llvm-config-3.8", "llvm-config-3.9", "llvm-config-4.0", "llvm-config-4.1" ]; // Prefer llvm-config* from LLVM_INSTALL_DIR diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index 5f7e7de1b3f..955850dfa97 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -5,13 +5,13 @@ import "qtc.js" as HelperFunctions Module { property string ide_version_major: '4' property string ide_version_minor: '0' - property string ide_version_release: '82' + property string ide_version_release: '83' property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release property string ide_compat_version_major: '4' property string ide_compat_version_minor: '0' - property string ide_compat_version_release: '82' + property string ide_compat_version_release: '83' property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release diff --git a/qtcreator.pri b/qtcreator.pri index 71fed2a8a98..66612428877 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -1,10 +1,10 @@ !isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included") QTCREATOR_PRI_INCLUDED = 1 -QTCREATOR_VERSION = 4.0.82 -QTCREATOR_COMPAT_VERSION = 4.0.82 +QTCREATOR_VERSION = 4.0.83 +QTCREATOR_COMPAT_VERSION = 4.0.83 VERSION = $$QTCREATOR_VERSION -BINARY_ARTIFACTS_BRANCH = master +BINARY_ARTIFACTS_BRANCH = 4.1 # enable c++11 CONFIG += c++11 diff --git a/qtcreator.qbs b/qtcreator.qbs index 487f6d47230..fb549ba0a7d 100644 --- a/qtcreator.qbs +++ b/qtcreator.qbs @@ -49,8 +49,7 @@ Project { break; } } - var fullQtcInstallDir - = FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, qbs.InstallDir); + var fullQtcInstallDir = FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix); var fullLibInstallDir = FileInfo.joinPaths(fullQtcInstallDir, qtc.ide_library_path); var fullPluginInstallDir = FileInfo.joinPaths(fullQtcInstallDir, qtc.ide_plugin_path); path = Qt.core.binPath + ";" + fullLibInstallDir + ";" + fullPluginInstallDir diff --git a/scripts/createSourcePackages.sh b/scripts/createSourcePackages.sh index ac4c43d3260..c25872d4196 100755 --- a/scripts/createSourcePackages.sh +++ b/scripts/createSourcePackages.sh @@ -34,6 +34,7 @@ cd ${TEMPSOURCES} || exit 1 tar xf __qtcreator_main.tar || exit 1 tar xf __qtcreator_qbs.tar || exit 1 tar czf "${RESULTDIR}/${PREFIX}.tar.gz" ${PREFIX}/ || exit 1 +tar cJf "${RESULTDIR}/${PREFIX}.tar.xz" ${PREFIX}/ || exit 1 echo "Creating zip archive..." echo " Filtering binary vs text files..." diff --git a/share/qtcreator/debugger/misctypes.py b/share/qtcreator/debugger/misctypes.py index 0b8c877d091..49bb5d46b84 100644 --- a/share/qtcreator/debugger/misctypes.py +++ b/share/qtcreator/debugger/misctypes.py @@ -346,3 +346,28 @@ def qdump__KDSoapValue(d, value): p = (value.cast(lookupType("char*")) + 4).dereference().cast(lookupType("QString")) d.putStringValue(p) d.putPlainChildren(value["d"]["d"].dereference()) + +####################################################################### +# +# Webkit +# +####################################################################### + +def qdump__WTF__String(d, value): + # WTF::String -> WTF::RefPtr<WTF::StringImpl> -> WTF::StringImpl* + data = value['m_impl']['m_ptr'] + d.checkPointer(data) + + stringLength = int(data['m_length']) + d.check(0 <= stringLength and stringLength <= 100000000) + + # WTF::StringImpl* -> WTF::StringImpl -> sizeof(WTF::StringImpl) + offsetToData = data.type.target().sizeof + bufferPtr = data.cast(d.charPtrType()) + offsetToData + + is8Bit = data['m_is8Bit'] + charSize = 1 + if not is8Bit: + charSize = 2 + + d.putCharArrayHelper(bufferPtr, stringLength, charSize) diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml index 8c5d85af5d8..43c7b3a7c96 100644 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml +++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml @@ -54,7 +54,11 @@ Rectangle { style: ButtonStyle { background: Rectangle { color: control.hovered ? Qt.lighter(baseColor, 1.2) : "transparent" - radius: 2 + Image { + source: "image://icons/close" + height: 16 + width: 16 + } } } @@ -64,7 +68,6 @@ Rectangle { anchors.verticalCenter: stateNameField.verticalCenter height: 16 width: 16 - iconSource: "images/darkclose.png" visible: !isBaseState onClicked: root.deleteState(internalNodeId) diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml index 5a67c536c6d..78ee0aab01e 100644 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml +++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml @@ -104,7 +104,6 @@ FocusScope { anchors.verticalCenter: parent.verticalCenter width: Math.max(parent.height / 2 - 8, 18) height: width - iconSource: "images/plus.png" onClicked: root.createNewState() @@ -113,6 +112,13 @@ FocusScope { property color buttonBaseColor: "#6f6f6f" color: control.hovered ? Qt.lighter(buttonBaseColor, 1.2) : buttonBaseColor border.width: 1 + Image { + source: "image://icons/plus" + width: 16 + height: 16 + anchors.centerIn: parent + smooth: false + } } } } diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/images/darkclose.png b/share/qtcreator/qmldesigner/statesEditorQmlSources/images/darkclose.png Binary files differdeleted file mode 100644 index 125078a2aea..00000000000 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/images/darkclose.png +++ /dev/null diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/images/plus.png b/share/qtcreator/qmldesigner/statesEditorQmlSources/images/plus.png Binary files differdeleted file mode 100644 index d16329ca450..00000000000 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/images/plus.png +++ /dev/null diff --git a/share/qtcreator/themes/flat-dark.creatortheme b/share/qtcreator/themes/flat-dark.creatortheme index 32eb10936c2..1e3e170b4c1 100644 --- a/share/qtcreator/themes/flat-dark.creatortheme +++ b/share/qtcreator/themes/flat-dark.creatortheme @@ -70,8 +70,8 @@ IconsInterruptColor=ff587ff7 IconsInterruptToolBarColor=ff6a7bc3 IconsDebugColor=toolBarItem IconsNavigationArrowsColor=ffebc322 -IconsBuildHammerHandleColor=ffc26b14 -IconsBuildHammerHeadColor=ff868687 +IconsBuildHammerHandleColor=ffb06112 +IconsBuildHammerHeadColor=ff828384 IconsModeWelcomeActiveColor=ff80c342 IconsModeEditActiveColor=ff99aaef IconsModeDesignActiveColor=ffbb6000 @@ -89,8 +89,8 @@ IconsCodeModelMacroColor=ff476ba0 IconsCodeModelAttributeColor=ff316511 IconsCodeModelUniformColor=ff994899 IconsCodeModelVaryingColor=ffa08833 -IconsCodeModelOverlayBackgroundColor=70ffffff -IconsCodeModelOverlayForegroundColor=ff232425 +IconsCodeModelOverlayBackgroundColor=70000000 +IconsCodeModelOverlayForegroundColor=ffd0d0d0 InfoBarBackground=ff505000 InfoBarText=text MenuBarEmptyAreaBackgroundColor=shadowBackground @@ -127,21 +127,21 @@ TreeViewArrowColorNormal=hoverBackground TreeViewArrowColorSelected=text OutputPanes_DebugTextColor=text -OutputPanes_ErrorMessageTextColor=ffaa0000 -OutputPanes_MessageOutput=ff0000aa -OutputPanes_NormalMessageTextColor=ff0000aa -OutputPanes_StdErrTextColor=ffaa0000 -OutputPanes_StdOutTextColor=ff000000 -OutputPanes_WarningMessageTextColor=ff808000 -OutputPanes_TestPassTextColor=ff009900 -OutputPanes_TestFailTextColor=ffa00000 -OutputPanes_TestXFailTextColor=ff28f028 -OutputPanes_TestXPassTextColor=fff02828 -OutputPanes_TestSkipTextColor=ff787878 -OutputPanes_TestWarnTextColor=ffd0bb00 -OutputPanes_TestFatalTextColor=ff640000 +OutputPanes_ErrorMessageTextColor=ffff6c6c +OutputPanes_MessageOutput=ff008787 +OutputPanes_NormalMessageTextColor=text +OutputPanes_StdErrTextColor=ffff6666 +OutputPanes_StdOutTextColor=text +OutputPanes_WarningMessageTextColor=fff3c300 +OutputPanes_TestPassTextColor=ff00b400 +OutputPanes_TestFailTextColor=ffcf4848 +OutputPanes_TestXFailTextColor=ff28dc28 +OutputPanes_TestXPassTextColor=ffdc2828 +OutputPanes_TestSkipTextColor=ff828282 +OutputPanes_TestWarnTextColor=ffc8c800 +OutputPanes_TestFatalTextColor=ffc82828 OutputPanes_TestDebugTextColor=ff329696 -OutputPaneButtonFlashColor=ffff0000 +OutputPaneButtonFlashColor=error OutputPaneToggleButtonTextColorChecked=fancyBarsNormalTextColor OutputPaneToggleButtonTextColorUnchecked=fancyBarsNormalTextColor diff --git a/src/libs/extensionsystem/pluginview.cpp b/src/libs/extensionsystem/pluginview.cpp index e86f98665bb..2dea6e1b251 100644 --- a/src/libs/extensionsystem/pluginview.cpp +++ b/src/libs/extensionsystem/pluginview.cpp @@ -314,7 +314,7 @@ PluginView::PluginView(QWidget *parent) m_categoryView->setSelectionMode(QAbstractItemView::SingleSelection); m_categoryView->setSelectionBehavior(QAbstractItemView::SelectRows); - m_model = new LeveledTreeModel<CollectionItem, PluginItem>(this); + m_model = new LeveledTreeModel<TreeItem, CollectionItem, PluginItem>(this); m_model->setHeader({ tr("Name"), tr("Load"), tr("Version"), tr("Vendor") }); m_sortModel = new CategorySortFilterModel(this); diff --git a/src/libs/extensionsystem/pluginview.h b/src/libs/extensionsystem/pluginview.h index 01e3dc45241..90016f529c7 100644 --- a/src/libs/extensionsystem/pluginview.h +++ b/src/libs/extensionsystem/pluginview.h @@ -71,7 +71,7 @@ private: bool setPluginsEnabled(const QSet<PluginSpec *> &plugins, bool enable); Utils::TreeView *m_categoryView; - Utils::LeveledTreeModel<Internal::CollectionItem, Internal::PluginItem> *m_model; + Utils::LeveledTreeModel<Utils::TreeItem, Internal::CollectionItem, Internal::PluginItem> *m_model; QSortFilterProxyModel *m_sortModel; friend class Internal::CollectionItem; diff --git a/src/libs/qtcreatorcdbext/common.h b/src/libs/qtcreatorcdbext/common.h index 0bfbcda0384..b538313b3f7 100644 --- a/src/libs/qtcreatorcdbext/common.h +++ b/src/libs/qtcreatorcdbext/common.h @@ -63,6 +63,18 @@ struct DebugPrint : public std::ostringstream { } }; +struct Bench +{ + Bench(const std::string &what) : m_initialTickCount(GetTickCount()), m_what(what) {} + ~Bench() + { + DebugPrint() << m_what << " took " + << GetTickCount() - m_initialTickCount << "ms to execute." << std::endl; + } + const DWORD m_initialTickCount; + const std::string m_what; +}; + ULONG currentThreadId(IDebugSystemObjects *sysObjects); ULONG currentThreadId(CIDebugClient *client); ULONG currentProcessId(IDebugSystemObjects *sysObjects); diff --git a/src/libs/timeline/qml/ButtonsBar.qml b/src/libs/timeline/qml/ButtonsBar.qml index 2da1f4e2b85..f1512e06a1d 100644 --- a/src/libs/timeline/qml/ButtonsBar.qml +++ b/src/libs/timeline/qml/ButtonsBar.qml @@ -30,7 +30,6 @@ import QtQuick.Controls.Styles 1.2 ToolBar { id: buttons - readonly property int buttonWidth: 30 signal jumpToPrev() signal jumpToNext() @@ -63,7 +62,7 @@ ToolBar { } background: Rectangle { anchors.fill: parent - color: "#9B9B9B" + color: creatorTheme.PanelStatusBarBackgroundColor } } @@ -71,62 +70,56 @@ ToolBar { spacing: 0 anchors.fill: parent - ToolButton { + ImageToolButton { id: jumpToPrevButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: "qrc:/timeline/ico_prev.png" + imageSource: "image://icons/prev" tooltip: qsTr("Jump to previous event.") onClicked: buttons.jumpToPrev() } - ToolButton { + ImageToolButton { id: jumpToNextButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: "qrc:/timeline/ico_next.png" + imageSource: "image://icons/next" tooltip: qsTr("Jump to next event.") onClicked: buttons.jumpToNext() } - ToolButton { + ImageToolButton { id: zoomControlButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: "qrc:/timeline/ico_zoom.png" + imageSource: "image://icons/zoom" tooltip: qsTr("Show zoom slider.") checkable: true checked: false onCheckedChanged: buttons.zoomControlChanged() } - ToolButton { + ImageToolButton { id: rangeButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: checked ? "qrc:/timeline/ico_rangeselected.png" : - "qrc:/timeline/ico_rangeselection.png" + imageSource: "image://icons/" + (checked ? "rangeselected" : "rangeselection"); tooltip: qsTr("Select range.") checkable: true checked: false onCheckedChanged: buttons.rangeSelectChanged() } - ToolButton { + ImageToolButton { id: lockButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: "qrc:/timeline/ico_selectionmode.png" + imageSource: "image://icons/selectionmode" tooltip: qsTr("View event information on mouseover.") checkable: true checked: false diff --git a/src/libs/timeline/qml/ImageToolButton.qml b/src/libs/timeline/qml/ImageToolButton.qml new file mode 100644 index 00000000000..8c0163785ca --- /dev/null +++ b/src/libs/timeline/qml/ImageToolButton.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Styles 1.2 + +ToolButton { + implicitWidth: 30 + + property string imageSource + + Image { + source: parent.enabled ? parent.imageSource : parent.imageSource + "/disabled" + width: 16 + height: 16 + anchors.centerIn: parent + } + + style: ButtonStyle { + background: Rectangle { + color: (control.checked || control.pressed) + ? creatorTheme.FancyToolButtonSelectedColor + : control.hovered + ? creatorTheme.FancyToolButtonHoverColor + : "#00000000" + } + } +} diff --git a/src/libs/timeline/qml/ico_next.png b/src/libs/timeline/qml/ico_next.png Binary files differdeleted file mode 100644 index c8a3374fd73..00000000000 --- a/src/libs/timeline/qml/ico_next.png +++ /dev/null diff --git a/src/libs/timeline/qml/ico_prev.png b/src/libs/timeline/qml/ico_prev.png Binary files differdeleted file mode 100644 index 0adf50462be..00000000000 --- a/src/libs/timeline/qml/ico_prev.png +++ /dev/null diff --git a/src/libs/timeline/qml/ico_rangeselected.png b/src/libs/timeline/qml/ico_rangeselected.png Binary files differindex b1a9031843e..1d4e0284f9a 100644 --- a/src/libs/timeline/qml/ico_rangeselected.png +++ b/src/libs/timeline/qml/ico_rangeselected.png diff --git a/src/libs/timeline/qml/ico_rangeselected@2x.png b/src/libs/timeline/qml/ico_rangeselected@2x.png Binary files differnew file mode 100644 index 00000000000..d108be37e0a --- /dev/null +++ b/src/libs/timeline/qml/ico_rangeselected@2x.png diff --git a/src/libs/timeline/qml/ico_rangeselection.png b/src/libs/timeline/qml/ico_rangeselection.png Binary files differindex dbe47a94720..546bf8beccd 100644 --- a/src/libs/timeline/qml/ico_rangeselection.png +++ b/src/libs/timeline/qml/ico_rangeselection.png diff --git a/src/libs/timeline/qml/ico_rangeselection@2x.png b/src/libs/timeline/qml/ico_rangeselection@2x.png Binary files differnew file mode 100644 index 00000000000..9f200fe43a8 --- /dev/null +++ b/src/libs/timeline/qml/ico_rangeselection@2x.png diff --git a/src/libs/timeline/qml/ico_selectionmode.png b/src/libs/timeline/qml/ico_selectionmode.png Binary files differindex 41493905c28..fcf28531d0c 100644 --- a/src/libs/timeline/qml/ico_selectionmode.png +++ b/src/libs/timeline/qml/ico_selectionmode.png diff --git a/src/libs/timeline/qml/ico_selectionmode@2x.png b/src/libs/timeline/qml/ico_selectionmode@2x.png Binary files differnew file mode 100644 index 00000000000..b34991e0790 --- /dev/null +++ b/src/libs/timeline/qml/ico_selectionmode@2x.png diff --git a/src/libs/timeline/qml/ico_zoom.png b/src/libs/timeline/qml/ico_zoom.png Binary files differdeleted file mode 100644 index d33b5ea0f9d..00000000000 --- a/src/libs/timeline/qml/ico_zoom.png +++ /dev/null diff --git a/src/libs/timeline/qml/timeline.qrc b/src/libs/timeline/qml/timeline.qrc index 92b6eaf10df..5bd2e1b20f6 100644 --- a/src/libs/timeline/qml/timeline.qrc +++ b/src/libs/timeline/qml/timeline.qrc @@ -17,11 +17,11 @@ <file>arrow_right.png</file> <file>range_handle.png</file> <file>ico_selectionmode.png</file> - <file>ico_zoom.png</file> - <file>ico_prev.png</file> - <file>ico_next.png</file> + <file>ico_selectionmode@2x.png</file> <file>ico_rangeselection.png</file> + <file>ico_rangeselection@2x.png</file> <file>ico_rangeselected.png</file> + <file>ico_rangeselected@2x.png</file> <file>ico_note.png</file> <file>ButtonsBar.qml</file> <file>timelineitems.vert</file> @@ -33,5 +33,6 @@ <file>RowLabel.qml</file> <file>SynchronousReloader.qml</file> <file>TimelineText.qml</file> + <file>ImageToolButton.qml</file> </qresource> </RCC> diff --git a/src/libs/timeline/timeline.pro b/src/libs/timeline/timeline.pro index 4b556057588..39fa4f3124d 100644 --- a/src/libs/timeline/timeline.pro +++ b/src/libs/timeline/timeline.pro @@ -15,7 +15,8 @@ SOURCES += \ $$PWD/timelinerenderstate.cpp \ $$PWD/timelinenotesmodel.cpp \ $$PWD/timelineabstractrenderer.cpp \ - $$PWD/timelineoverviewrenderer.cpp + $$PWD/timelineoverviewrenderer.cpp \ + $$PWD/timelinetheme.cpp HEADERS += \ @@ -37,7 +38,8 @@ HEADERS += \ $$PWD/timelineabstractrenderer.h \ $$PWD/timelineabstractrenderer_p.h \ $$PWD/timelineoverviewrenderer_p.h \ - $$PWD/timelineoverviewrenderer.h + $$PWD/timelineoverviewrenderer.h \ + $$PWD/timelinetheme.h RESOURCES += \ $$PWD/qml/timeline.qrc diff --git a/src/libs/timeline/timeline.qbs b/src/libs/timeline/timeline.qbs index 8474db9eb82..216462819a1 100644 --- a/src/libs/timeline/timeline.qbs +++ b/src/libs/timeline/timeline.qbs @@ -28,6 +28,7 @@ Project { "timelinerenderpass.cpp", "timelinerenderpass.h", "timelinerenderstate.cpp", "timelinerenderstate.h", "timelinerenderstate_p.h", "timelineselectionrenderpass.cpp", "timelineselectionrenderpass.h", + "timelinetheme.cpp", "timelinetheme.h", "timelinezoomcontrol.cpp", "timelinezoomcontrol.h" ] } diff --git a/src/libs/timeline/timelinetheme.cpp b/src/libs/timeline/timelinetheme.cpp new file mode 100644 index 00000000000..8731f2b5acc --- /dev/null +++ b/src/libs/timeline/timelinetheme.cpp @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "timelinetheme.h" + +#include <utils/icon.h> +#include <utils/qtcassert.h> +#include <utils/utilsicons.h> +#include <utils/theme/theme.h> + +#include <QIcon> +#include <QQmlContext> +#include <QQmlEngine> +#include <QQmlPropertyMap> +#include <QQuickImageProvider> + +namespace Timeline { + +class TimelineImageIconProvider : public QQuickImageProvider +{ +public: + TimelineImageIconProvider() + : QQuickImageProvider(Pixmap) + { + } + + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override + { + Q_UNUSED(requestedSize) + + const QStringList idElements = id.split(QLatin1Char('/')); + + QTC_ASSERT(!idElements.isEmpty(), return QPixmap()); + const QString &iconName = idElements.first(); + const QIcon::Mode iconMode = (idElements.count() > 1 + && idElements.at(1) == QLatin1String("disabled")) + ? QIcon::Disabled : QIcon::Normal; + + Utils::Icon icon; + if (iconName == QLatin1String("prev")) + icon = Utils::Icons::PREV_TOOLBAR; + else if (iconName == QLatin1String("next")) + icon = Utils::Icons::NEXT_TOOLBAR; + else if (iconName == QLatin1String("zoom")) + icon = Utils::Icons::ZOOM_TOOLBAR; + else if (iconName == QLatin1String("rangeselection")) + icon = Utils::Icon({{QLatin1String(":/timeline/ico_rangeselection.png"), + Utils::Theme::IconsBaseColor}}); + else if (iconName == QLatin1String("rangeselected")) + icon = Utils::Icon({{QLatin1String(":/timeline/ico_rangeselected.png"), + Utils::Theme::IconsBaseColor}}); + else if (iconName == QLatin1String("selectionmode")) + icon = Utils::Icon({{QLatin1String(":/timeline/ico_selectionmode.png"), + Utils::Theme::IconsBaseColor}}); + + const QSize iconSize(16, 16); + const QPixmap result = icon.icon().pixmap(iconSize, iconMode); + + if (size) + *size = result.size(); + return result; + } +}; + +void TimelineTheme::setupTheme(QQmlEngine *engine) +{ + QQmlPropertyMap *themePropertyMap = new QQmlPropertyMap(engine); + const QVariantHash creatorTheme = Utils::creatorTheme()->values(); + for (auto it = creatorTheme.constBegin(); it != creatorTheme.constEnd(); ++it) + themePropertyMap->insert(it.key(), it.value()); + + engine->rootContext()->setContextProperty(QLatin1String("creatorTheme"), themePropertyMap); + + engine->addImageProvider(QLatin1String("icons"), new TimelineImageIconProvider); +} + +} // namespace Timeline diff --git a/src/libs/timeline/timelinetheme.h b/src/libs/timeline/timelinetheme.h new file mode 100644 index 00000000000..24412b757ac --- /dev/null +++ b/src/libs/timeline/timelinetheme.h @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "timeline_global.h" + +QT_FORWARD_DECLARE_CLASS(QQmlEngine) + +namespace Timeline { + +class TIMELINE_EXPORT TimelineTheme { +public: + static void setupTheme(QQmlEngine* engine); +}; + +} // namespace Timeline diff --git a/src/libs/utils/functiontraits.h b/src/libs/utils/functiontraits.h index 2544b525d91..4c172eefba3 100644 --- a/src/libs/utils/functiontraits.h +++ b/src/libs/utils/functiontraits.h @@ -155,6 +155,9 @@ struct functionTraits<Callable&&> : public functionTraits<Callable> { }; +template <typename F> +using functionResult_t = typename functionTraits<F>::ResultType; + //////////////////// // functionTakesArgument //////////////////// diff --git a/src/libs/utils/mapreduce.h b/src/libs/utils/mapreduce.h index 007056ecc81..828b16b31f9 100644 --- a/src/libs/utils/mapreduce.h +++ b/src/libs/utils/mapreduce.h @@ -243,7 +243,7 @@ protected: }; template <typename ResultType, typename Function, typename... Args> -typename functionTraits<Function>::ResultType +functionResult_t<Function> callWithMaybeFutureInterfaceDispatch(std::false_type, QFutureInterface<ResultType> &, Function &&function, Args&&... args) { @@ -251,7 +251,7 @@ callWithMaybeFutureInterfaceDispatch(std::false_type, QFutureInterface<ResultTyp } template <typename ResultType, typename Function, typename... Args> -typename functionTraits<Function>::ResultType +functionResult_t<Function> callWithMaybeFutureInterfaceDispatch(std::true_type, QFutureInterface<ResultType> &futureInterface, Function &&function, Args&&... args) { @@ -259,7 +259,7 @@ callWithMaybeFutureInterfaceDispatch(std::true_type, QFutureInterface<ResultType } template <typename ResultType, typename Function, typename... Args> -typename functionTraits<Function>::ResultType +functionResult_t<Function> callWithMaybeFutureInterface(QFutureInterface<ResultType> &futureInterface, Function &&function, Args&&... args) { diff --git a/src/libs/utils/runextensions.h b/src/libs/utils/runextensions.h index e08cc02bd6f..43a25411d6e 100644 --- a/src/libs/utils/runextensions.h +++ b/src/libs/utils/runextensions.h @@ -98,7 +98,7 @@ struct resultTypeWithArgument<Function, QFutureInterface<ResultType>&> template <typename Function, typename Arg> struct resultTypeWithArgument { - using type = typename functionTraits<Function>::ResultType; + using type = functionResult_t<Function>; }; template <typename Function, int index> @@ -110,7 +110,7 @@ struct resultTypeTakesArguments<Function, index, true> template <typename Function, int index> struct resultTypeTakesArguments<Function, index, false> { - using type = typename functionTraits<Function>::ResultType; + using type = functionResult_t<Function>; }; template <typename Function> diff --git a/src/libs/utils/theme/theme.cpp b/src/libs/utils/theme/theme.cpp index cf730739c37..7195cab29d3 100644 --- a/src/libs/utils/theme/theme.cpp +++ b/src/libs/utils/theme/theme.cpp @@ -182,10 +182,8 @@ void Theme::readSettings(QSettings &settings) } { settings.beginGroup(QLatin1String("Palette")); - foreach (const QString &key, settings.allKeys()) { - QColor c = readColor(settings.value(key).toString()); - d->palette[key] = c; - } + foreach (const QString &key, settings.allKeys()) + d->palette[key] = readNamedColor(settings.value(key).toString()).first; settings.endGroup(); } { diff --git a/src/libs/utils/treemodel.cpp b/src/libs/utils/treemodel.cpp index dd297bb62c7..bb629c94db7 100644 --- a/src/libs/utils/treemodel.cpp +++ b/src/libs/utils/treemodel.cpp @@ -617,17 +617,12 @@ TreeItem::~TreeItem() removeChildren(); } -TreeItem *TreeItem::child(int pos) const +TreeItem *TreeItem::childAt(int pos) const { QTC_ASSERT(pos >= 0, return 0); return pos < m_children.size() ? m_children.at(pos) : 0; } -int TreeItem::rowCount() const -{ - return m_children.size(); -} - QVariant TreeItem::data(int column, int role) const { Q_UNUSED(column); @@ -651,7 +646,7 @@ Qt::ItemFlags TreeItem::flags(int column) const bool TreeItem::hasChildren() const { - return canFetchMore() || rowCount() > 0; + return canFetchMore() || childCount() > 0; } bool TreeItem::canFetchMore() const @@ -692,11 +687,11 @@ void TreeItem::insertChild(int pos, TreeItem *item) void TreeItem::removeChildren() { - if (rowCount() == 0) + if (childCount() == 0) return; if (m_model) { QModelIndex idx = index(); - m_model->beginRemoveRows(idx, 0, rowCount() - 1); + m_model->beginRemoveRows(idx, 0, childCount() - 1); clear(); m_model->endRemoveRows(); } else { @@ -707,7 +702,7 @@ void TreeItem::removeChildren() void TreeItem::sortChildren(const std::function<bool(const TreeItem *, const TreeItem *)> &cmp) { if (m_model) { - if (const int n = rowCount()) { + if (const int n = childCount()) { QVector<TreeItem *> tmp = m_children; std::sort(tmp.begin(), tmp.end(), cmp); if (tmp == m_children) { @@ -850,8 +845,8 @@ QModelIndex TreeModel::parent(const QModelIndex &idx) const if (!grandparent) return QModelIndex(); - for (int i = 0, n = grandparent->rowCount(); i < n; ++i) - if (grandparent->child(i) == parent) + for (int i = 0, n = grandparent->childCount(); i < n; ++i) + if (grandparent->childAt(i) == parent) return createIndex(i, 0, (void*) parent); return QModelIndex(); @@ -861,12 +856,12 @@ int TreeModel::rowCount(const QModelIndex &idx) const { CHECK_INDEX(idx); if (!idx.isValid()) - return m_root->rowCount(); + return m_root->childCount(); if (idx.column() > 0) return 0; const TreeItem *item = itemForIndex(idx); QTC_ASSERT(item, return 0); - return item->rowCount(); + return item->childCount(); } int TreeModel::columnCount(const QModelIndex &idx) const @@ -985,9 +980,9 @@ QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) con const TreeItem *item = itemForIndex(parent); QTC_ASSERT(item, return QModelIndex()); - if (row >= item->rowCount()) + if (row >= item->childCount()) return QModelIndex(); - return createIndex(row, column, (void*)(item->child(row))); + return createIndex(row, column, (void*)(item->childAt(row))); } TreeItem *TreeModel::itemForIndex(const QModelIndex &idx) const @@ -1049,6 +1044,11 @@ TreeItem *TreeModel::takeItem(TreeItem *item) return item; } +void TreeModel::destroyItem(TreeItem *item) +{ + delete takeItem(item); +} + StaticTreeItem::StaticTreeItem(const QStringList &displays) : m_displays(displays) { diff --git a/src/libs/utils/treemodel.h b/src/libs/utils/treemodel.h index 3dad7a58232..6f308ff2369 100644 --- a/src/libs/utils/treemodel.h +++ b/src/libs/utils/treemodel.h @@ -41,10 +41,6 @@ public: TreeItem(); virtual ~TreeItem(); - TreeItem *parent() const { return m_parent; } - virtual TreeItem *child(int pos) const; - virtual int rowCount() const; - virtual QVariant data(int column, int role) const; virtual bool setData(int column, const QVariant &data, int role); virtual Qt::ItemFlags flags(int column) const; @@ -53,6 +49,8 @@ public: virtual bool canFetchMore() const; virtual void fetchMore() {} + TreeItem *parent() const { return m_parent; } + void prependChild(TreeItem *item); void appendChild(TreeItem *item); void insertChild(int pos, TreeItem *item); @@ -67,7 +65,7 @@ public: void setFlags(Qt::ItemFlags flags); int childCount() const { return m_children.size(); } - TreeItem *childAt(int index) const { return m_children.at(index); } + TreeItem *childAt(int index) const; QVector<TreeItem *> children() const { return m_children; } QModelIndex index() const; @@ -230,6 +228,7 @@ public: void fetchMore(const QModelIndex &idx) override; TreeItem *takeItem(TreeItem *item); // item is not destroyed. + void destroyItem(TreeItem *item); // item is destroyed. signals: void requestExpansion(QModelIndex); diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp index 81ce2350cf3..8894118436d 100644 --- a/src/plugins/android/androidtoolchain.cpp +++ b/src/plugins/android/androidtoolchain.cpp @@ -231,7 +231,10 @@ bool AndroidToolChain::isSecondaryToolChain() const void AndroidToolChain::setSecondaryToolChain(bool b) { + if (m_secondaryToolChain == b) + return; m_secondaryToolChain = b; + toolChainUpdated(); } GccToolChain::DetectedAbisResult AndroidToolChain::detectSupportedAbis() const diff --git a/src/plugins/autotest/autotest.qrc b/src/plugins/autotest/autotest.qrc index 7c8539f4b2c..f92f835e599 100644 --- a/src/plugins/autotest/autotest.qrc +++ b/src/plugins/autotest/autotest.qrc @@ -1,10 +1,6 @@ <RCC> <qresource prefix="/"> <file>images/autotest.png</file> - <file>images/expand.png</file> - <file>images/expand@2x.png</file> - <file>images/collapse.png</file> - <file>images/collapse@2x.png</file> <file>images/sort.png</file> <file>images/sort@2x.png</file> <file>images/leafsort.png</file> diff --git a/src/plugins/autotest/autotesticons.h b/src/plugins/autotest/autotesticons.h index 35a9614a5fe..f7845b071f8 100644 --- a/src/plugins/autotest/autotesticons.h +++ b/src/plugins/autotest/autotesticons.h @@ -30,10 +30,6 @@ namespace Autotest { namespace Icons { -const Utils::Icon EXPAND({ - {QLatin1String(":/images/expand.png"), Utils::Theme::IconsBaseColor}}); -const Utils::Icon COLLAPSE({ - {QLatin1String(":/images/collapse.png"), Utils::Theme::IconsBaseColor}}); const Utils::Icon SORT_ALPHABETICALLY({ {QLatin1String(":/images/sort.png"), Utils::Theme::IconsBaseColor}}); const Utils::Icon SORT_NATURALLY({ diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp index 7e6e0b3c3c4..2680736e767 100644 --- a/src/plugins/autotest/testcodeparser.cpp +++ b/src/plugins/autotest/testcodeparser.cpp @@ -202,30 +202,14 @@ static void performParse(QFutureInterface<TestParseResultPtr> &futureInterface, /****** threaded parsing stuff *******/ -void TestCodeParser::onCppDocumentUpdated(const CPlusPlus::Document::Ptr &document) +void TestCodeParser::onDocumentUpdated(const QString &fileName) { - if (m_codeModelParsing) { - if (!m_fullUpdatePostponed) { - m_partialUpdatePostponed = true; - m_postponedFiles.insert(document->fileName()); - } - return; - } - ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject(); if (!project) return; - const QString fileName = document->fileName(); - if (!project->files(ProjectExplorer::Project::AllFiles).contains(fileName)) + if (!project->files(ProjectExplorer::Project::SourceFiles).contains(fileName)) return; - qCDebug(LOG) << "calling scanForTests (onCppDocumentUpdated)"; - scanForTests(QStringList(fileName)); -} - -void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document) -{ - const QString &fileName = document->fileName(); if (m_codeModelParsing) { if (!m_fullUpdatePostponed) { m_partialUpdatePostponed = true; @@ -234,22 +218,28 @@ void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document) return; } - ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject(); - if (!project) - return; - if (!project->files(ProjectExplorer::Project::AllFiles).contains(fileName)) { - // what if the file is not listed inside the pro file, but will be used anyway? - return; - } - scanForTests(QStringList(fileName)); } +void TestCodeParser::onCppDocumentUpdated(const CPlusPlus::Document::Ptr &document) +{ + onDocumentUpdated(document->fileName()); +} + +void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document) +{ + const QString fileName = document->fileName(); + if (!fileName.endsWith(".qbs")) + onDocumentUpdated(fileName); +} + void TestCodeParser::onStartupProjectChanged(ProjectExplorer::Project *project) { - if (m_parserState == FullParse || m_parserState == PartialParse) + if (m_parserState == FullParse || m_parserState == PartialParse) { + qCDebug(LOG) << "Canceling scanForTest (startup project changed)"; Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE); - else if (project) + } + if (project) emitUpdateTestTree(); } @@ -275,6 +265,7 @@ bool TestCodeParser::postponed(const QStringList &fileList) m_partialUpdatePostponed = false; m_postponedFiles.clear(); m_fullUpdatePostponed = true; + qCDebug(LOG) << "Canceling scanForTest (full parse triggered while running a scan)"; Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE); } else { // partial parse triggered, but full parse is postponed already, ignoring this @@ -315,7 +306,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList) bool isFullParse = fileList.isEmpty(); QStringList list; if (isFullParse) { - list = ProjectExplorer::SessionManager::startupProject()->files(ProjectExplorer::Project::AllFiles); + list = ProjectExplorer::SessionManager::startupProject()->files(ProjectExplorer::Project::SourceFiles); if (list.isEmpty()) return; qCDebug(LOG) << "setting state to FullParse (scanForTests)"; @@ -352,8 +343,15 @@ void TestCodeParser::scanForTests(const QStringList &fileList) void TestCodeParser::onTaskStarted(Core::Id type) { - if (type == CppTools::Constants::TASK_INDEX) + if (type == CppTools::Constants::TASK_INDEX) { m_codeModelParsing = true; + if (m_parserState == FullParse || m_parserState == PartialParse) { + m_fullUpdatePostponed = m_parserState == FullParse; + m_partialUpdatePostponed = !m_fullUpdatePostponed; + qCDebug(LOG) << "Canceling scan for test (CppModelParsing started)"; + Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE); + } + } } void TestCodeParser::onAllTasksFinished(Core::Id type) diff --git a/src/plugins/autotest/testcodeparser.h b/src/plugins/autotest/testcodeparser.h index 19b58dfa468..d9779525f8a 100644 --- a/src/plugins/autotest/testcodeparser.h +++ b/src/plugins/autotest/testcodeparser.h @@ -82,6 +82,7 @@ private: bool postponed(const QStringList &fileList); void scanForTests(const QStringList &fileList = QStringList()); + void onDocumentUpdated(const QString &fileName); void onTaskStarted(Core::Id type); void onAllTasksFinished(Core::Id type); void onFinished(); diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index db39b91bbaf..0e92789ae3f 100644 --- a/src/plugins/autotest/testconfiguration.cpp +++ b/src/plugins/autotest/testconfiguration.cpp @@ -172,6 +172,7 @@ void TestConfiguration::completeTestInformation(int runMode) env = stdRunnable.environment; hasDesktopTarget = true; guessedRunConfiguration = true; + runConfigTarget = rc->target(); } } } @@ -186,7 +187,7 @@ void TestConfiguration::completeTestInformation(int runMode) setEnvironment(env); setProject(project); setGuessedConfiguration(guessedRunConfiguration); - if (!guessedRunConfiguration && runMode == TestRunner::Debug) + if (runMode == TestRunner::Debug) m_runConfig = new TestRunConfiguration(runConfigTarget, this); } } diff --git a/src/plugins/autotest/testnavigationwidget.cpp b/src/plugins/autotest/testnavigationwidget.cpp index 39f616b1c2d..6f91f4b1220 100644 --- a/src/plugins/autotest/testnavigationwidget.cpp +++ b/src/plugins/autotest/testnavigationwidget.cpp @@ -202,11 +202,11 @@ QList<QToolButton *> TestNavigationWidget::createToolButtons() m_sort->setToolTip(tr("Sort Naturally")); QToolButton *expand = new QToolButton(this); - expand->setIcon(Icons::EXPAND.icon()); + expand->setIcon(Core::Icons::EXPAND_TOOLBAR.icon()); expand->setToolTip(tr("Expand All")); QToolButton *collapse = new QToolButton(this); - collapse->setIcon(Icons::COLLAPSE.icon()); + collapse->setIcon(Core::Icons::COLLAPSE_TOOLBAR.icon()); collapse->setToolTip(tr("Collapse All")); connect(expand, &QToolButton::clicked, m_view, &TestTreeView::expandAll); diff --git a/src/plugins/autotest/testresultmodel.cpp b/src/plugins/autotest/testresultmodel.cpp index 12299e0b64a..b42ab5cd628 100644 --- a/src/plugins/autotest/testresultmodel.cpp +++ b/src/plugins/autotest/testresultmodel.cpp @@ -209,7 +209,7 @@ void TestResultModel::removeCurrentTestMessage() for (int row = topLevelItems.size() - 1; row >= 0; --row) { TestResultItem *current = static_cast<TestResultItem *>(topLevelItems.at(row)); if (current->testResult()->result() == Result::MessageCurrentTest) { - delete takeItem(current); + destroyItem(current); break; } } diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 78b8a8971aa..3571e6c34af 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -146,7 +146,7 @@ TestResultsPane::TestResultsPane(QObject *parent) : void TestResultsPane::createToolButtons() { m_expandCollapse = new QToolButton(m_treeView); - m_expandCollapse->setIcon(Core::Icons::EXPAND.icon()); + m_expandCollapse->setIcon(Core::Icons::EXPAND_ALL_TOOLBAR.icon()); m_expandCollapse->setToolTip(tr("Expand All")); m_expandCollapse->setCheckable(true); m_expandCollapse->setChecked(false); @@ -231,8 +231,7 @@ QWidget *TestResultsPane::outputWidget(QWidget *parent) QList<QWidget *> TestResultsPane::toolBarWidgets() const { - return QList<QWidget *>() << m_expandCollapse << m_runAll << m_runSelected << m_stopTestRun - << m_filterButton; + return { m_expandCollapse, m_runAll, m_runSelected, m_stopTestRun, m_filterButton }; } QString TestResultsPane::displayName() const @@ -338,7 +337,7 @@ void TestResultsPane::goToNext() if (!rootItem || !rootItem->childCount()) return; - nextCurrentIndex = m_filterModel->mapFromSource(m_model->indexForItem(rootItem->child(0))); + nextCurrentIndex = m_filterModel->mapFromSource(m_model->indexForItem(rootItem->childAt(0))); } m_treeView->setCurrentIndex(nextCurrentIndex); diff --git a/src/plugins/autotest/testtreeitem.cpp b/src/plugins/autotest/testtreeitem.cpp index 145ac5c344d..9cc3e861405 100644 --- a/src/plugins/autotest/testtreeitem.cpp +++ b/src/plugins/autotest/testtreeitem.cpp @@ -217,7 +217,7 @@ TestTreeItem *TestTreeItem::parentItem() const TestTreeItem *TestTreeItem::childItem(int row) const { - return static_cast<TestTreeItem *>(child(row)); + return static_cast<TestTreeItem *>(childAt(row)); } TestTreeItem *TestTreeItem::findChildByName(const QString &name) diff --git a/src/plugins/autotest/testtreemodel.cpp b/src/plugins/autotest/testtreemodel.cpp index 11165ae0824..706f1331ce8 100644 --- a/src/plugins/autotest/testtreemodel.cpp +++ b/src/plugins/autotest/testtreemodel.cpp @@ -257,14 +257,14 @@ bool TestTreeModel::sweepChildren(TestTreeItem *item) TestTreeItem *child = item->childItem(row); if (child->parentItem()->type() != TestTreeItem::Root && child->markedForRemoval()) { - delete takeItem(child); + destroyItem(child); hasChanged = true; continue; } if (bool noEndNode = child->hasChildren()) { hasChanged |= sweepChildren(child); if (noEndNode && child->childCount() == 0) { - delete takeItem(child); + destroyItem(child); hasChanged = true; continue; } diff --git a/src/plugins/baremetal/gdbserverproviderssettingspage.cpp b/src/plugins/baremetal/gdbserverproviderssettingspage.cpp index ba4d5250e10..0d2fdd1d305 100644 --- a/src/plugins/baremetal/gdbserverproviderssettingspage.cpp +++ b/src/plugins/baremetal/gdbserverproviderssettingspage.cpp @@ -184,7 +184,7 @@ void GdbServerProviderModel::markForRemoval(GdbServerProvider *provider) { GdbServerProviderNode *n = findNode(provider); QTC_ASSERT(n, return); - delete takeItem(n); + destroyItem(n); if (m_providersToAdd.contains(provider)) { m_providersToAdd.removeOne(provider); @@ -233,7 +233,7 @@ void GdbServerProviderModel::removeProvider(GdbServerProvider *provider) { m_providersToRemove.removeAll(provider); if (GdbServerProviderNode *n = findNode(provider)) - delete takeItem(n); + destroyItem(n); emit providerStateChanged(); } diff --git a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp index 6cce4ffeb15..a810deb5f9b 100644 --- a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp +++ b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp @@ -108,10 +108,9 @@ void openEditorAt(const ClangBackEnd::SourceLocationContainer &location) int(location.column() - 1)); } -void applyFixit(const ClangBackEnd::SourceLocationContainer &location, - const QVector<ClangBackEnd::FixItContainer> &fixits) +void applyFixit(const QVector<ClangBackEnd::FixItContainer> &fixits) { - ClangCodeModel::ClangFixItOperation operation(location.filePath(), Utf8String(), fixits); + ClangCodeModel::ClangFixItOperation operation(Utf8String(), fixits); operation.perform(); } @@ -146,7 +145,7 @@ QWidget *createDiagnosticLabel(const ClangBackEnd::DiagnosticContainer &diagnost label->setTextFormat(Qt::RichText); QObject::connect(label, &QLabel::linkActivated, [location, fixits](const QString &action) { if (action == QLatin1String(LINK_ACTION_APPLY_FIX)) - applyFixit(location, fixits); + applyFixit(fixits); else openEditorAt(location); diff --git a/src/plugins/clangcodemodel/clangfixitoperation.cpp b/src/plugins/clangcodemodel/clangfixitoperation.cpp index 431286c4751..f064b8d2778 100644 --- a/src/plugins/clangcodemodel/clangfixitoperation.cpp +++ b/src/plugins/clangcodemodel/clangfixitoperation.cpp @@ -27,16 +27,21 @@ #include <texteditor/refactoringchanges.h> +#include <utils/qtcassert.h> + #include <QTextDocument> namespace ClangCodeModel { -ClangFixItOperation::ClangFixItOperation(const Utf8String &filePath, - const Utf8String &fixItText, - const QVector<ClangBackEnd::FixItContainer> &fixItContainers) - : filePath(filePath), - fixItText(fixItText), - fixItContainers(fixItContainers) +using FileToFixits = QMap<QString, QVector<ClangBackEnd::FixItContainer>>; +using FileToFixitsIterator = QMapIterator<QString, QVector<ClangBackEnd::FixItContainer>>; +using RefactoringFilePtr = QSharedPointer<TextEditor::RefactoringFile>; + +ClangFixItOperation::ClangFixItOperation( + const Utf8String &fixItText, + const QVector<ClangBackEnd::FixItContainer> &fixItContainers) + : fixItText(fixItText) + , fixItContainers(fixItContainers) { } @@ -50,20 +55,56 @@ QString ClangCodeModel::ClangFixItOperation::description() const return QStringLiteral("Apply Fix: ") + fixItText.toString(); } +static FileToFixits fixitsPerFile(const QVector<ClangBackEnd::FixItContainer> &fixItContainers) +{ + FileToFixits mapping; + + for (const auto &fixItContainer : fixItContainers) { + const QString rangeStartFilePath = fixItContainer.range().start().filePath().toString(); + const QString rangeEndFilePath = fixItContainer.range().end().filePath().toString(); + QTC_CHECK(rangeStartFilePath == rangeEndFilePath); + mapping[rangeStartFilePath].append(fixItContainer); + } + + return mapping; +} + void ClangFixItOperation::perform() { const TextEditor::RefactoringChanges refactoringChanges; - refactoringFile = refactoringChanges.file(filePath.toString()); - refactoringFile->setChangeSet(changeSet()); - refactoringFile->apply(); + const FileToFixits fileToFixIts = fixitsPerFile(fixItContainers); + + FileToFixitsIterator i(fileToFixIts); + while (i.hasNext()) { + i.next(); + const QString filePath = i.key(); + const QVector<ClangBackEnd::FixItContainer> fixits = i.value(); + + RefactoringFilePtr refactoringFile = refactoringChanges.file(filePath); + refactoringFiles.append(refactoringFile); + + applyFixitsToFile(*refactoringFile, fixits); + } } -QString ClangFixItOperation::refactoringFileContent_forTestOnly() const +QString ClangFixItOperation::firstRefactoringFileContent_forTestOnly() const { - return refactoringFile->document()->toPlainText(); + return refactoringFiles.first()->document()->toPlainText(); +} + +void ClangFixItOperation::applyFixitsToFile( + TextEditor::RefactoringFile &refactoringFile, + const QVector<ClangBackEnd::FixItContainer> fixItContainers) +{ + const Utils::ChangeSet changeSet = toChangeSet(refactoringFile, fixItContainers); + + refactoringFile.setChangeSet(changeSet); + refactoringFile.apply(); } -Utils::ChangeSet ClangFixItOperation::changeSet() const +Utils::ChangeSet ClangFixItOperation::toChangeSet( + TextEditor::RefactoringFile &refactoringFile, + const QVector<ClangBackEnd::FixItContainer> fixItContainers) const { Utils::ChangeSet changeSet; @@ -71,8 +112,8 @@ Utils::ChangeSet ClangFixItOperation::changeSet() const const auto range = fixItContainer.range(); const auto start = range.start(); const auto end = range.end(); - changeSet.replace(refactoringFile->position(start.line(), start.column()), - refactoringFile->position(end.line(), end.column()), + changeSet.replace(refactoringFile.position(start.line(), start.column()), + refactoringFile.position(end.line(), end.column()), fixItContainer.text()); } diff --git a/src/plugins/clangcodemodel/clangfixitoperation.h b/src/plugins/clangcodemodel/clangfixitoperation.h index 83a8c8ed2ec..e4183451b49 100644 --- a/src/plugins/clangcodemodel/clangfixitoperation.h +++ b/src/plugins/clangcodemodel/clangfixitoperation.h @@ -36,6 +36,7 @@ namespace TextEditor { +class RefactoringChanges; class RefactoringFile; } @@ -44,23 +45,25 @@ namespace ClangCodeModel { class ClangFixItOperation : public TextEditor::QuickFixOperation { public: - ClangFixItOperation(const Utf8String &filePath, - const Utf8String &fixItText, + ClangFixItOperation(const Utf8String &fixItText, const QVector<ClangBackEnd::FixItContainer> &fixItContainers); int priority() const override; QString description() const override; void perform() override; - QString refactoringFileContent_forTestOnly() const; + QString firstRefactoringFileContent_forTestOnly() const; private: - Utils::ChangeSet changeSet() const; + void applyFixitsToFile(TextEditor::RefactoringFile &refactoringFile, + const QVector<ClangBackEnd::FixItContainer> fixItContainers); + Utils::ChangeSet toChangeSet( + TextEditor::RefactoringFile &refactoringFile, + const QVector<ClangBackEnd::FixItContainer> fixItContainers) const; private: - Utf8String filePath; Utf8String fixItText; - QSharedPointer<TextEditor::RefactoringFile> refactoringFile; + QVector<QSharedPointer<TextEditor::RefactoringFile>> refactoringFiles; QVector<ClangBackEnd::FixItContainer> fixItContainers; }; diff --git a/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp b/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp index 7203e18dcb0..91da3de4e15 100644 --- a/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp +++ b/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp @@ -109,16 +109,13 @@ ClangFixItOperationsExtractor::extract(const QString &filePath, int line) } void ClangFixItOperationsExtractor::appendFixitOperation( - const QString &filePath, const QString &diagnosticText, const QVector<ClangBackEnd::FixItContainer> &fixits) { if (!fixits.isEmpty()) { const QString diagnosticTextTweaked = tweakedDiagnosticText(diagnosticText); TextEditor::QuickFixOperation::Ptr operation( - new ClangFixItOperation(filePath, - diagnosticTextTweaked, - fixits)); + new ClangFixItOperation(diagnosticTextTweaked, fixits)); operations.append(operation); } } @@ -130,7 +127,7 @@ void ClangFixItOperationsExtractor::extractFromDiagnostic( { const QVector<ClangBackEnd::FixItContainer> fixIts = diagnosticContainer.fixIts(); if (hasFixItAt(fixIts, filePath, line)) { - appendFixitOperation(filePath, diagnosticContainer.text().toString(), fixIts); + appendFixitOperation(diagnosticContainer.text().toString(), fixIts); foreach (const auto &child, diagnosticContainer.children()) extractFromDiagnostic(child, filePath, line); diff --git a/src/plugins/clangcodemodel/clangfixitoperationsextractor.h b/src/plugins/clangcodemodel/clangfixitoperationsextractor.h index 6c49a3da181..f0b1fb83abf 100644 --- a/src/plugins/clangcodemodel/clangfixitoperationsextractor.h +++ b/src/plugins/clangcodemodel/clangfixitoperationsextractor.h @@ -42,8 +42,7 @@ private: void extractFromDiagnostic(const ClangBackEnd::DiagnosticContainer &diagnosticContainer, const QString &filePath, int line); - void appendFixitOperation(const QString &filePath, - const QString &diagnosticText, + void appendFixitOperation(const QString &diagnosticText, const QVector<ClangBackEnd::FixItContainer> &fixits); private: diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp index 39d1d945bfa..36fee7b5070 100644 --- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp +++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp @@ -273,7 +273,7 @@ QVariant ExplainingStepItem::data(int column, int role) const return QVariant::fromValue(static_cast<DiagnosticItem *>(parent())->diagnostic()); case Qt::DisplayRole: { const int row = parent()->children().indexOf(const_cast<ExplainingStepItem *>(this)) + 1; - const int padding = static_cast<int>(std::log10(parent()->rowCount())) + const int padding = static_cast<int>(std::log10(parent()->childCount())) - static_cast<int>(std::log10(row)); return QString::fromLatin1("%1%2: %3") .arg(QString(padding, QLatin1Char(' '))) diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index c286a22c017..1987ae86799 100644 --- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -183,7 +183,10 @@ public: || type == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID) optionsBuilder.addDefine("#define _X86INTRIN_H_INCLUDED\n"); - optionsBuilder.addToolchainAndProjectDefines(); + if (type != ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) + optionsBuilder.addDefines(projectPart.toolchainDefines); + optionsBuilder.addDefines(projectPart.projectDefines); + optionsBuilder.undefineClangVersionMacrosForMsvc(); optionsBuilder.undefineCppLanguageFeatureMacrosForMsvc2015(); optionsBuilder.addHeaderPathOptions(); optionsBuilder.addMsvcCompatibilityVersion(); @@ -203,6 +206,23 @@ public: { } +public: + void undefineClangVersionMacrosForMsvc() + { + if (m_projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) { + static QStringList macroNames { + "__clang__", + "__clang_major__", + "__clang_minor__", + "__clang_patchlevel__", + "__clang_version__" + }; + + foreach (const QString ¯oName, macroNames) + add(QLatin1String("/U") + macroName); + } + } + private: void addTargetTriple() override { @@ -272,6 +292,14 @@ static QStringList createOptionsToUndefineCppLanguageFeatureMacrosForMsvc2015( return optionsBuilder.options(); } +static QStringList createOptionsToUndefineClangVersionMacrosForMsvc(const ProjectPart &projectPart) +{ + ClangStaticAnalyzerOptionsBuilder optionsBuilder(projectPart); + optionsBuilder.undefineClangVersionMacrosForMsvc(); + + return optionsBuilder.options(); +} + static QStringList tweakedArguments(const ProjectPart &projectPart, const QString &filePath, const QStringList &arguments, @@ -281,6 +309,7 @@ static QStringList tweakedArguments(const ProjectPart &projectPart, prependWordWidthArgumentIfNotIncluded(&newArguments, extraParams.wordWidth); prependTargetTripleIfNotIncludedAndNotEmpty(&newArguments, extraParams.targetTriple); newArguments.append(createMsCompatibilityVersionOption(projectPart)); + newArguments.append(createOptionsToUndefineClangVersionMacrosForMsvc(projectPart)); newArguments.append(createOptionsToUndefineCppLanguageFeatureMacrosForMsvc2015(projectPart)); return newArguments; @@ -564,7 +593,8 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithSuccess(const QString &l void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &errorMessage, const QString &errorDetails) { - qCDebug(LOG) << "onRunnerFinishedWithFailure:" << errorMessage << errorDetails; + qCDebug(LOG).noquote() << "onRunnerFinishedWithFailure:" + << errorMessage << '\n' << errorDetails; ++m_filesNotAnalyzed; m_success = false; diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index 3b5e24612cc..04ee9f8155f 100644 --- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -27,6 +27,7 @@ #include "clangstaticanalyzerconstants.h" +#include <utils/qtcprocess.h> #include <utils/synchronousprocess.h> #include <QDebug> @@ -111,9 +112,9 @@ bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList & QTC_ASSERT(!m_logFile.isEmpty(), return false); const QStringList arguments = constructCommandLineArguments(filePath, m_logFile, compilerOptions); - m_commandLine = (QStringList(m_clangExecutable) + arguments).join(QLatin1String("\" \"")); + m_commandLine = Utils::QtcProcess::joinArgs(QStringList(m_clangExecutable) + arguments); - qCDebug(LOG) << "Starting" << m_commandLine; + qCDebug(LOG).noquote() << "Starting" << m_commandLine; m_process.start(m_clangExecutable, arguments); return true; } @@ -171,12 +172,13 @@ QString ClangStaticAnalyzerRunner::createLogFile(const QString &filePath) const QString ClangStaticAnalyzerRunner::processCommandlineAndOutput() const { - return tr("Command line: \"%1\"\n" + return tr("Command line: %1\n" "Process Error: %2\n" "Output:\n%3") .arg(m_commandLine, QString::number(m_process.error()), - QString::fromLocal8Bit(m_processOutput)); + Utils::SynchronousProcess::normalizeNewlines( + QString::fromLocal8Bit(m_processOutput))); } QString ClangStaticAnalyzerRunner::actualLogFile() const diff --git a/src/plugins/clangstaticanalyzer/unit-tests/stdc++11-includes/main.cpp b/src/plugins/clangstaticanalyzer/unit-tests/stdc++11-includes/main.cpp index b394f380c38..cfa5d8021e3 100644 --- a/src/plugins/clangstaticanalyzer/unit-tests/stdc++11-includes/main.cpp +++ b/src/plugins/clangstaticanalyzer/unit-tests/stdc++11-includes/main.cpp @@ -16,7 +16,9 @@ #include <climits> #include <clocale> #include <cmath> -#include <codecvt> +#if !defined(__GNUC__) || __GNUC__ >= 5 +# include <codecvt> +#endif #include <complex> #include <condition_variable> #include <csetjmp> diff --git a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp index ca133101140..c7b19033550 100644 --- a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp +++ b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp @@ -189,12 +189,12 @@ void CMakeToolItemModel::addCMakeTool(const CMakeTool *item, bool changed) TreeItem *CMakeToolItemModel::autoGroupItem() const { - return rootItem()->child(0); + return rootItem()->childAt(0); } TreeItem *CMakeToolItemModel::manualGroupItem() const { - return rootItem()->child(1); + return rootItem()->childAt(1); } void CMakeToolItemModel::reevaluateChangedFlag(CMakeToolTreeItem *item) const @@ -242,7 +242,7 @@ void CMakeToolItemModel::removeCMakeTool(const Core::Id &id) CMakeToolTreeItem *treeItem = cmakeToolItem(id); QTC_ASSERT(treeItem, return); - delete takeItem(treeItem); + destroyItem(treeItem); m_removedItems.append(id); } diff --git a/src/plugins/coreplugin/core.qrc b/src/plugins/coreplugin/core.qrc index a8c2c0a76c9..e88ca8c6740 100644 --- a/src/plugins/coreplugin/core.qrc +++ b/src/plugins/coreplugin/core.qrc @@ -108,5 +108,9 @@ <file>images/desktopdevicesmall.png</file> <file>images/desktopdevicesmall@2x.png</file> <file>images/reset@2x.png</file> + <file>images/collapse.png</file> + <file>images/collapse@2x.png</file> + <file>images/expand.png</file> + <file>images/expand@2x.png</file> </qresource> </RCC> diff --git a/src/plugins/coreplugin/coreicons.cpp b/src/plugins/coreplugin/coreicons.cpp index 213492bcb04..5727821c713 100644 --- a/src/plugins/coreplugin/coreicons.cpp +++ b/src/plugins/coreplugin/coreicons.cpp @@ -130,7 +130,7 @@ const Icon INFO({ {QLatin1String(":/core/images/info.png"), Theme::IconsInfoColor}}, Icon::Tint); const Icon INFO_TOOLBAR({ {QLatin1String(":/core/images/info.png"), Theme::IconsInfoToolBarColor}}); -const Icon EXPAND({ +const Icon EXPAND_ALL_TOOLBAR({ {QLatin1String(":/find/images/expand.png"), Theme::IconsBaseColor}}); const Icon TOOLBAR_EXTENSION({ {QLatin1String(":/core/images/extension.png"), Theme::IconsBaseColor}}); @@ -155,6 +155,14 @@ const Icon EYE_CLOSED_TOOLBAR({ const Icon REPLACE({ {QLatin1String(":/core/images/replace_a.png"), Theme::PanelTextColorMid}, {QLatin1String(":/core/images/replace_b.png"), Theme::IconsInfoColor}}, Icon::Tint); +const Icon EXPAND({ + {QLatin1String(":/core/images/expand.png"), Theme::PanelTextColorMid}}, Utils::Icon::Tint); +const Icon EXPAND_TOOLBAR({ + {QLatin1String(":/core/images/expand.png"), Theme::IconsBaseColor}}); +const Icon COLLAPSE({ + {QLatin1String(":/core/images/collapse.png"), Theme::PanelTextColorMid}}, Utils::Icon::Tint); +const Icon COLLAPSE_TOOLBAR({ + {QLatin1String(":/core/images/collapse.png"), Theme::IconsBaseColor}}); const Icon MODE_EDIT_CLASSIC( QLatin1String(":/fancyactionbar/images/mode_Edit.png")); diff --git a/src/plugins/coreplugin/coreicons.h b/src/plugins/coreplugin/coreicons.h index c2837cb8ec6..7882edf5e4e 100644 --- a/src/plugins/coreplugin/coreicons.h +++ b/src/plugins/coreplugin/coreicons.h @@ -81,7 +81,7 @@ CORE_EXPORT extern const Utils::Icon ERROR_TOOLBAR; CORE_EXPORT extern const Utils::Icon ERROR_TASKBAR; CORE_EXPORT extern const Utils::Icon INFO; CORE_EXPORT extern const Utils::Icon INFO_TOOLBAR; -CORE_EXPORT extern const Utils::Icon EXPAND; +CORE_EXPORT extern const Utils::Icon EXPAND_ALL_TOOLBAR; CORE_EXPORT extern const Utils::Icon TOOLBAR_EXTENSION; CORE_EXPORT extern const Utils::Icon RUN_SMALL; CORE_EXPORT extern const Utils::Icon RUN_SMALL_TOOLBAR; @@ -93,6 +93,10 @@ CORE_EXPORT extern const Utils::Icon BOUNDING_RECT; CORE_EXPORT extern const Utils::Icon EYE_OPEN_TOOLBAR; CORE_EXPORT extern const Utils::Icon EYE_CLOSED_TOOLBAR; CORE_EXPORT extern const Utils::Icon REPLACE; +CORE_EXPORT extern const Utils::Icon EXPAND; +CORE_EXPORT extern const Utils::Icon EXPAND_TOOLBAR; +CORE_EXPORT extern const Utils::Icon COLLAPSE; +CORE_EXPORT extern const Utils::Icon COLLAPSE_TOOLBAR; CORE_EXPORT extern const Utils::Icon MODE_EDIT_CLASSIC; CORE_EXPORT extern const Utils::Icon MODE_EDIT_FLAT; diff --git a/src/plugins/coreplugin/dialogs/addtovcsdialog.cpp b/src/plugins/coreplugin/dialogs/addtovcsdialog.cpp index 51d997b93e7..56ab0a2455d 100644 --- a/src/plugins/coreplugin/dialogs/addtovcsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/addtovcsdialog.cpp @@ -26,6 +26,7 @@ #include "addtovcsdialog.h" #include "ui_addtovcsdialog.h" +#include <QDir> #include <QListWidgetItem> namespace Core { @@ -45,7 +46,7 @@ AddToVcsDialog::AddToVcsDialog(QWidget *parent, const QString &title, setWindowTitle(title); foreach (const QString &file, files) { - QListWidgetItem *item = new QListWidgetItem(file); + QListWidgetItem *item = new QListWidgetItem(QDir::toNativeSeparators(file)); ui->filesListWidget->addItem(item); } } diff --git a/src/plugins/coreplugin/find/searchresultwindow.cpp b/src/plugins/coreplugin/find/searchresultwindow.cpp index 0031e5466a6..abf0f36da17 100644 --- a/src/plugins/coreplugin/find/searchresultwindow.cpp +++ b/src/plugins/coreplugin/find/searchresultwindow.cpp @@ -136,7 +136,7 @@ namespace Internal { m_expandCollapseButton->setAutoRaise(true); m_expandCollapseAction->setCheckable(true); - m_expandCollapseAction->setIcon(Core::Icons::EXPAND.icon()); + m_expandCollapseAction->setIcon(Core::Icons::EXPAND_ALL_TOOLBAR.icon()); Command *cmd = ActionManager::registerAction(m_expandCollapseAction, "Find.ExpandAll"); cmd->setAttribute(Command::CA_UpdateText); m_expandCollapseButton->setDefaultAction(cmd->action()); @@ -340,8 +340,8 @@ QWidget *SearchResultWindow::outputWidget(QWidget *) */ QList<QWidget*> SearchResultWindow::toolBarWidgets() const { - return QList<QWidget*>() << d->m_expandCollapseButton << d->m_spacer - << d->m_historyLabel << d->m_spacer2 << d->m_recentSearchesBox; + return { d->m_expandCollapseButton, d->m_spacer, + d->m_historyLabel, d->m_spacer2, d->m_recentSearchesBox }; } /*! diff --git a/src/plugins/autotest/images/collapse.png b/src/plugins/coreplugin/images/collapse.png Binary files differindex c8dc840a61e..c8dc840a61e 100644 --- a/src/plugins/autotest/images/collapse.png +++ b/src/plugins/coreplugin/images/collapse.png diff --git a/src/plugins/autotest/images/collapse@2x.png b/src/plugins/coreplugin/images/collapse@2x.png Binary files differindex 823e6cc6496..823e6cc6496 100644 --- a/src/plugins/autotest/images/collapse@2x.png +++ b/src/plugins/coreplugin/images/collapse@2x.png diff --git a/src/plugins/autotest/images/expand.png b/src/plugins/coreplugin/images/expand.png Binary files differindex a8b3f4a486e..a8b3f4a486e 100644 --- a/src/plugins/autotest/images/expand.png +++ b/src/plugins/coreplugin/images/expand.png diff --git a/src/plugins/autotest/images/expand@2x.png b/src/plugins/coreplugin/images/expand@2x.png Binary files differindex c3466cd2ab6..c3466cd2ab6 100644 --- a/src/plugins/autotest/images/expand@2x.png +++ b/src/plugins/coreplugin/images/expand@2x.png diff --git a/src/plugins/coreplugin/locator/locatorsettingspage.cpp b/src/plugins/coreplugin/locator/locatorsettingspage.cpp index bfb1a001bb5..076c67e3c64 100644 --- a/src/plugins/coreplugin/locator/locatorsettingspage.cpp +++ b/src/plugins/coreplugin/locator/locatorsettingspage.cpp @@ -359,7 +359,7 @@ void LocatorSettingsPage::removeCustomFilter() QTC_ASSERT(item, return); ILocatorFilter *filter = item->filter(); QTC_ASSERT(m_customFilters.contains(filter), return); - delete m_model->takeItem(item); + m_model->destroyItem(item); m_filters.removeAll(filter); m_customFilters.removeAll(filter); m_refreshFilters.removeAll(filter); diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index faf78f925d7..a5bf1ad0b65 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -137,10 +137,15 @@ void CompilerOptionsBuilder::addHeaderPathOptions(bool addAsNativePath) void CompilerOptionsBuilder::addToolchainAndProjectDefines() { - QByteArray extendedDefines = m_projectPart.toolchainDefines + m_projectPart.projectDefines; + addDefines(m_projectPart.toolchainDefines); + addDefines(m_projectPart.projectDefines); +} + +void CompilerOptionsBuilder::addDefines(const QByteArray &defineDirectives) +{ QStringList result; - foreach (QByteArray def, extendedDefines.split('\n')) { + foreach (QByteArray def, defineDirectives.split('\n')) { if (def.isEmpty() || excludeDefineLine(def)) continue; diff --git a/src/plugins/cpptools/compileroptionsbuilder.h b/src/plugins/cpptools/compileroptionsbuilder.h index 4ef43b53da4..739db8b5f67 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.h +++ b/src/plugins/cpptools/compileroptionsbuilder.h @@ -48,6 +48,7 @@ public: virtual void enableExceptions(); void addHeaderPathOptions(bool addAsNativePath = false); void addToolchainAndProjectDefines(); + void addDefines(const QByteArray &defineDirectives); virtual void addLanguageOption(ProjectFile::Kind fileKind); virtual void addOptionsForLanguage(bool checkForBorlandExtensions = true); diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 823a750b91c..75248167983 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -348,7 +348,7 @@ void BreakHandler::deletionHelper(BreakpointModelId id) { Breakpoint b = breakpointById(id); QTC_ASSERT(b, return); - delete takeItem(b.b); + destroyItem(b.b); } Breakpoint BreakHandler::findWatchpoint(const BreakpointParameters ¶ms) const @@ -1169,7 +1169,7 @@ void BreakHandler::changeLineNumberFromMarkerHelper(BreakpointModelId id) Breakpoint b = breakpointById(id); QTC_ASSERT(b, return); BreakpointParameters params = b.parameters(); - delete takeItem(b.b); + destroyItem(b.b); appendBreakpoint(params); } diff --git a/src/plugins/debugger/console/consoleitemdelegate.cpp b/src/plugins/debugger/console/consoleitemdelegate.cpp index 12646fddab6..b2a2f188b77 100644 --- a/src/plugins/debugger/console/consoleitemdelegate.cpp +++ b/src/plugins/debugger/console/consoleitemdelegate.cpp @@ -69,8 +69,8 @@ ConsoleItemDelegate::ConsoleItemDelegate(ConsoleItemModel *model, QObject *paren m_logIcon(Core::Icons::INFO.icon()), m_warningIcon(Core::Icons::WARNING.icon()), m_errorIcon(Core::Icons::ERROR.icon()), - m_expandIcon(QLatin1String(":/qmljstools/images/expand.png")), - m_collapseIcon(QLatin1String(":/qmljstools/images/collapse.png")), + m_expandIcon(Core::Icons::EXPAND.icon()), + m_collapseIcon(Core::Icons::COLLAPSE.icon()), m_prompt(QLatin1String(":/qmljstools/images/prompt.png")), m_cachedHeight(0) { diff --git a/src/plugins/debugger/console/consoleitemmodel.cpp b/src/plugins/debugger/console/consoleitemmodel.cpp index 1373556a0e3..fc65764c71a 100644 --- a/src/plugins/debugger/console/consoleitemmodel.cpp +++ b/src/plugins/debugger/console/consoleitemmodel.cpp @@ -80,7 +80,7 @@ int ConsoleItemModel::sizeOfFile(const QFont &font) lastReadOnlyRow -= 2; // skip editable row if (lastReadOnlyRow < 0) return 0; - QString filename = static_cast<ConsoleItem *>(rootItem()->child(lastReadOnlyRow))->file(); + QString filename = static_cast<ConsoleItem *>(rootItem()->childAt(lastReadOnlyRow))->file(); const int pos = filename.lastIndexOf(QLatin1Char('/')); if (pos != -1) filename = filename.mid(pos + 1); diff --git a/src/plugins/debugger/debuggeroptionspage.cpp b/src/plugins/debugger/debuggeroptionspage.cpp index 6026e444f5d..359451bb3a8 100644 --- a/src/plugins/debugger/debuggeroptionspage.cpp +++ b/src/plugins/debugger/debuggeroptionspage.cpp @@ -169,7 +169,7 @@ void DebuggerItemModel::removeCurrentDebugger() QVariant id = m_currentTreeItem->m_item.id(); DebuggerTreeItem *treeItem = m_currentTreeItem; m_currentTreeItem = 0; - delete takeItem(treeItem); + destroyItem(treeItem); m_removedItems.append(id); } diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp index e08a9045a4e..e90093f5041 100644 --- a/src/plugins/debugger/moduleshandler.cpp +++ b/src/plugins/debugger/moduleshandler.cpp @@ -157,8 +157,8 @@ QVariant ModuleItem::data(int column, int role) const static ModuleItem *moduleFromPath(TreeItem *root, const QString &modulePath) { // Recent modules are more likely to be unloaded first. - for (int i = root->rowCount(); --i >= 0; ) { - auto item = static_cast<ModuleItem *>(root->child(i)); + for (int i = root->childCount(); --i >= 0; ) { + auto item = static_cast<ModuleItem *>(root->childAt(i)); if (item->module.modulePath == modulePath) return item; } @@ -199,15 +199,15 @@ Modules ModulesHandler::modules() const { Modules mods; TreeItem *root = m_model->rootItem(); - for (int i = root->rowCount(); --i >= 0; ) - mods.append(static_cast<ModuleItem *>(root->child(i))->module); + for (int i = root->childCount(); --i >= 0; ) + mods.append(static_cast<ModuleItem *>(root->childAt(i))->module); return mods; } void ModulesHandler::removeModule(const QString &modulePath) { if (ModuleItem *item = moduleFromPath(m_model->rootItem(), modulePath)) - delete m_model->takeItem(item); + m_model->destroyItem(item); } void ModulesHandler::updateModule(const Module &module) @@ -239,17 +239,17 @@ void ModulesHandler::updateModule(const Module &module) void ModulesHandler::beginUpdateAll() { TreeItem *root = m_model->rootItem(); - for (int i = root->rowCount(); --i >= 0; ) - static_cast<ModuleItem *>(root->child(i))->updated = false; + for (int i = root->childCount(); --i >= 0; ) + static_cast<ModuleItem *>(root->childAt(i))->updated = false; } void ModulesHandler::endUpdateAll() { TreeItem *root = m_model->rootItem(); - for (int i = root->rowCount(); --i >= 0; ) { - auto item = static_cast<ModuleItem *>(root->child(i)); + for (int i = root->childCount(); --i >= 0; ) { + auto item = static_cast<ModuleItem *>(root->childAt(i)); if (!item->updated) - delete m_model->takeItem(item); + m_model->destroyItem(item); } } diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index f387a9ae974..ce102d55f34 100644 --- a/src/plugins/debugger/threadshandler.cpp +++ b/src/plugins/debugger/threadshandler.cpp @@ -320,7 +320,7 @@ void ThreadsHandler::updateThread(const ThreadData &threadData) void ThreadsHandler::removeThread(ThreadId threadId) { if (ThreadItem *item = itemForThreadId(this, threadId)) - delete takeItem(item); + destroyItem(item); } void ThreadsHandler::setThreads(const Threads &threads) @@ -363,7 +363,7 @@ bool ThreadsHandler::notifyGroupExited(const QString &groupId) list.append(item); }); foreach (ThreadItem *item, list) - delete takeItem(item); + destroyItem(item); m_pidForGroupId.remove(groupId); return m_pidForGroupId.isEmpty(); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index d52d4e6ed02..8387f3f2e9a 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1162,7 +1162,7 @@ bool WatchModel::hasChildren(const QModelIndex &idx) const const WatchItem *item = nonRootItemForIndex(idx); if (!item) return true; - if (item->rowCount() > 0) + if (item->childCount() > 0) return true; // "Can fetch more", see above. @@ -1289,7 +1289,7 @@ bool WatchHandler::insertItem(WatchItem *item) const QVector<TreeItem *> siblings = parent->children(); for (int row = 0, n = siblings.size(); row < n; ++row) { if (static_cast<WatchItem *>(siblings.at(row))->iname == item->iname) { - delete m_model->takeItem(parent->children().at(row)); + m_model->destroyItem(parent->children().at(row)); parent->insertChild(row, item); found = true; break; @@ -1377,7 +1377,7 @@ void WatchHandler::notifyUpdateFinished() }); foreach (auto item, toRemove) - delete m_model->takeItem(item); + m_model->destroyItem(item); m_model->m_contentsValid = true; updateWatchersWindow(); @@ -1400,7 +1400,7 @@ void WatchHandler::removeItemByIName(const QString &iname) theWatcherNames.remove(item->exp); saveWatchers(); } - delete m_model->takeItem(item); + m_model->destroyItem(item); updateWatchersWindow(); } diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index f22ce5faffc..e903a58d072 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -177,16 +177,16 @@ QStringList BaseController::addConfigurationArguments(const QStringList &args) c { QTC_ASSERT(!args.isEmpty(), return args); - QStringList realArgs; - realArgs << args.at(0); - realArgs << QLatin1String("-m"); // show diff against parents instead of merge commits - realArgs << QLatin1String("-M") << QLatin1String("-C"); // Detect renames and copies - realArgs << QLatin1String("--first-parent"); // show only first parent + QStringList realArgs = { + args.at(0), + "-m", // show diff against parents instead of merge commits + "-M", "-C", // Detect renames and copies + "--first-parent" // show only first parent + }; if (ignoreWhitespace()) - realArgs << QLatin1String("--ignore-space-change"); - realArgs << QLatin1String("--unified=") + QString::number(contextLineCount()); - realArgs << QLatin1String("--src-prefix=a/") << QLatin1String("--dst-prefix=b/"); - realArgs << args.mid(1); + realArgs << "--ignore-space-change"; + realArgs << "--unified=" + QString::number(contextLineCount()) + << "--src-prefix=a/" << "--dst-prefix=b/" << args.mid(1); return realArgs; } @@ -204,7 +204,7 @@ QStringList BaseController::addHeadWhenCommandInProgress() const // instead of showing unsupported combined diff format. GitClient::CommandInProgress commandInProgress = GitPlugin::client()->checkCommandInProgress(m_directory); if (commandInProgress != GitClient::NoCommand) - args << QLatin1String(HEAD); + args << HEAD; return args; } @@ -221,8 +221,7 @@ public: void RepositoryDiffController::reload() { - QStringList args; - args << QLatin1String("diff"); + QStringList args = { "diff" }; args.append(addHeadWhenCommandInProgress()); runCommand(QList<QStringList>() << addConfigurationArguments(args)); } @@ -244,10 +243,10 @@ private: void FileDiffController::reload() { - QStringList args; - args << QLatin1String("diff"); + QStringList args = { "diff" }; args.append(addHeadWhenCommandInProgress()); - args << QLatin1String("--") << m_fileName; + args << "--" << m_fileName; + runCommand(QList<QStringList>() << addConfigurationArguments(args)); } @@ -273,16 +272,14 @@ void FileListDiffController::reload() { QList<QStringList> argLists; if (!m_stagedFiles.isEmpty()) { - QStringList stagedArgs; - stagedArgs << QLatin1String("diff") << QLatin1String("--cached") << QLatin1String("--") - << m_stagedFiles; + QStringList stagedArgs = { "diff", "--cached", "--" }; + stagedArgs << m_stagedFiles; argLists << addConfigurationArguments(stagedArgs); } if (!m_unstagedFiles.isEmpty()) { - QStringList unstagedArgs; - unstagedArgs << QLatin1String("diff") << addHeadWhenCommandInProgress() - << QLatin1String("--") << m_unstagedFiles; + QStringList unstagedArgs = { "diff" }; + unstagedArgs << addHeadWhenCommandInProgress() << "--" << m_unstagedFiles; argLists << addConfigurationArguments(unstagedArgs); } @@ -308,9 +305,8 @@ private: void ProjectDiffController::reload() { - QStringList args; - args << QLatin1String("diff") << addHeadWhenCommandInProgress() - << QLatin1String("--") << m_projectPaths; + QStringList args = { "diff" }; + args << addHeadWhenCommandInProgress() << "--" << m_projectPaths; runCommand(QList<QStringList>() << addConfigurationArguments(args)); } @@ -332,8 +328,8 @@ private: void BranchDiffController::reload() { - QStringList args; - args << QLatin1String("diff") << addHeadWhenCommandInProgress() << m_branch; + QStringList args = { "diff" }; + args << addHeadWhenCommandInProgress() << m_branch; runCommand(QList<QStringList>() << addConfigurationArguments(args)); } @@ -359,9 +355,7 @@ private: void ShowController::reload() { - QStringList args; - args << QLatin1String("show") << QLatin1String("-s") << QLatin1String(noColorOption) - << QLatin1String(decorateOption) << QLatin1String(showFormatC) << m_id; + const QStringList args = { "show", "-s", noColorOption, decorateOption, showFormatC, m_id }; m_state = GettingDescription; runCommand(QList<QStringList>() << args, GitPlugin::client()->encoding(m_directory, "i18n.commitEncoding")); } @@ -380,9 +374,8 @@ void ShowController::reloadFinished(bool success) QTC_ASSERT(m_state != Idle, return); if (m_state == GettingDescription && success) { - QStringList args; - args << QLatin1String("show") << QLatin1String("--format=format:") // omit header, already generated - << QLatin1String(noColorOption) << QLatin1String(decorateOption) << m_id; + const QStringList args = { "show", "--format=format:", // omit header, already generated + noColorOption, decorateOption, m_id }; m_state = GettingDiff; runCommand(QList<QStringList>() << addConfigurationArguments(args)); return; @@ -399,17 +392,15 @@ class BaseGitDiffArgumentsWidget : public VcsBaseEditorParameterWidget Q_OBJECT public: - BaseGitDiffArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) : + BaseGitDiffArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = nullptr) : VcsBaseEditorParameterWidget(parent) { - m_patienceButton = addToggleButton( - QLatin1String("--patience"), - tr("Patience"), - tr("Use the patience algorithm for calculating the differences.")); + m_patienceButton + = addToggleButton("--patience", tr("Patience"), + tr("Use the patience algorithm for calculating the differences.")); mapSetting(m_patienceButton, settings.boolPointer(GitSettings::diffPatienceKey)); - m_ignoreWSButton = addToggleButton( - QLatin1String("--ignore-space-change"), tr("Ignore Whitespace"), - tr("Ignore whitespace only changes.")); + m_ignoreWSButton = addToggleButton("--ignore-space-change", tr("Ignore Whitespace"), + tr("Ignore whitespace only changes.")); mapSetting(m_ignoreWSButton, settings.boolPointer(GitSettings::ignoreSpaceChangesInDiffKey)); } @@ -424,13 +415,13 @@ class GitBlameArgumentsWidget : public VcsBaseEditorParameterWidget Q_OBJECT public: - GitBlameArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) : + GitBlameArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = nullptr) : VcsBaseEditorParameterWidget(parent) { mapSetting(addToggleButton(QString(), tr("Omit Date"), tr("Hide the date of a change from the output.")), settings.boolPointer(GitSettings::omitAnnotationDateKey)); - mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace"), + mapSetting(addToggleButton("-w", tr("Ignore Whitespace"), tr("Ignore whitespace only changes.")), settings.boolPointer(GitSettings::ignoreSpaceChangesInBlameKey)); } @@ -441,21 +432,22 @@ class GitLogArgumentsWidget : public BaseGitDiffArgumentsWidget Q_OBJECT public: - GitLogArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = 0) : + GitLogArgumentsWidget(VcsBaseClientSettings &settings, QWidget *parent = nullptr) : BaseGitDiffArgumentsWidget(settings, parent) { - QToolButton *diffButton = addToggleButton(QLatin1String("--patch"), tr("Show Diff"), + QToolButton *diffButton = addToggleButton("--patch", tr("Show Diff"), tr("Show difference.")); mapSetting(diffButton, settings.boolPointer(GitSettings::logDiffKey)); connect(diffButton, &QToolButton::toggled, m_patienceButton, &QToolButton::setVisible); connect(diffButton, &QToolButton::toggled, m_ignoreWSButton, &QToolButton::setVisible); m_patienceButton->setVisible(diffButton->isChecked()); m_ignoreWSButton->setVisible(diffButton->isChecked()); - QStringList graphArguments(QLatin1String("--graph")); - graphArguments << QLatin1String("--oneline") << QLatin1String("--topo-order"); - graphArguments << (QLatin1String("--pretty=format:") + QLatin1String(graphLogFormatC)); + const QStringList graphArguments = { + "--graph", "--oneline", "--topo-order", + (QLatin1String("--pretty=format:") + graphLogFormatC) + }; QToolButton *graphButton = addToggleButton(graphArguments, tr("Graph"), - tr("Show textual graph log.")); + tr("Show textual graph log.")); mapSetting(graphButton, settings.boolPointer(GitSettings::graphLogKey)); } }; @@ -508,8 +500,8 @@ private: void readStdOut(const QString &data) { - static QRegExp patchFailedRE(QLatin1String("Patch failed at ([^\\n]*)")); - static QRegExp conflictedFilesRE(QLatin1String("Merge conflict in ([^\\n]*)")); + static QRegExp patchFailedRE("Patch failed at ([^\\n]*)"); + static QRegExp conflictedFilesRE("Merge conflict in ([^\\n]*)"); if (patchFailedRE.indexIn(data) != -1) m_commit = patchFailedRE.cap(1); int fileIndex = -1; @@ -519,7 +511,7 @@ private: void readStdErr(const QString &data) { - static QRegExp couldNotApplyRE(QLatin1String("[Cc]ould not (?:apply|revert) ([^\\n]*)")); + static QRegExp couldNotApplyRE("[Cc]ould not (?:apply|revert) ([^\\n]*)"); if (couldNotApplyRE.indexIn(data) != -1) m_commit = couldNotApplyRE.cap(1); } @@ -539,7 +531,7 @@ public: } private: - GitProgressParser() : m_progressExp(QLatin1String("\\((\\d+)/(\\d+)\\)")) // e.g. Rebasing (7/42) + GitProgressParser() : m_progressExp("\\((\\d+)/(\\d+)\\)") // e.g. Rebasing (7/42) { } void parseProgress(const QString &text) override @@ -578,7 +570,7 @@ static inline void msgCannotRun(const QStringList &args, const QString &workingD const QByteArray &error, QString *errorMessage) { const QString message = GitClient::tr("Cannot run \"%1\" in \"%2\": %3") - .arg(QLatin1String("git ") + args.join(QLatin1Char(' ')), + .arg("git " + args.join(' '), QDir::toNativeSeparators(workingDirectory), GitClient::commandOutputFromLocal8Bit(error)); @@ -600,20 +592,17 @@ GitClient::GitClient() : VcsBase::VcsBaseClientImpl(new GitSettings), QString GitClient::findRepositoryForDirectory(const QString &dir) const { - if (dir.isEmpty() || dir.endsWith(QLatin1String("/.git")) - || dir.contains(QLatin1String("/.git/"))) { + if (dir.isEmpty() || dir.endsWith("/.git") || dir.contains("/.git/")) return QString(); - } QDir directory(dir); - QString dotGit = QLatin1String(GIT_DIRECTORY); // QFileInfo is outside loop, because it is faster this way QFileInfo fileInfo; do { - if (directory.exists(dotGit)) { - fileInfo.setFile(directory, dotGit); + if (directory.exists(GIT_DIRECTORY)) { + fileInfo.setFile(directory, GIT_DIRECTORY); if (fileInfo.isFile()) return directory.absolutePath(); - else if (directory.exists(QLatin1String(".git/config"))) + else if (directory.exists(".git/config")) return directory.absolutePath(); } } while (!directory.isRoot() && directory.cdUp()); @@ -627,18 +616,17 @@ QString GitClient::findGitDirForRepository(const QString &repositoryDir) const if (!res.isEmpty()) return res; - synchronousRevParseCmd(repositoryDir, QLatin1String("--git-dir"), &res); + synchronousRevParseCmd(repositoryDir, "--git-dir", &res); if (!QDir(res).isAbsolute()) - res.prepend(repositoryDir + QLatin1Char('/')); + res.prepend(repositoryDir + '/'); return res; } bool GitClient::managesFile(const QString &workingDirectory, const QString &fileName) const { QByteArray output; - QStringList arguments; - arguments << QLatin1String("ls-files") << QLatin1String("--error-unmatch") << fileName; + const QStringList arguments = { "ls-files", "--error-unmatch", fileName }; return vcsFullySynchronousExec(workingDirectory, arguments, &output, 0, silentFlags); } @@ -650,7 +638,7 @@ QTextCodec *GitClient::codecFor(GitClient::CodecType codecType, const QString &s } if (codecType == CodecLogOutput) return encoding(source, "i18n.logOutputEncoding"); - return 0; + return nullptr; } void GitClient::slotChunkActionsRequested(QMenu *menu, bool isValid) @@ -706,9 +694,9 @@ void GitClient::stage(const QString &patch, bool revert) patchFile.write(patchData); patchFile.close(); - QStringList args = QStringList() << QLatin1String("--cached"); + QStringList args = { "--cached" }; if (revert) - args << QLatin1String("--reverse"); + args << "--reverse"; QString errorMessage; if (synchronousApplyPatch(baseDir, patchFile.fileName(), &errorMessage, args)) { @@ -815,10 +803,8 @@ void GitClient::merge(const QString &workingDirectory, void GitClient::status(const QString &workingDirectory) { - QStringList statusArgs; - statusArgs << QLatin1String("status") << QLatin1String("-u"); VcsOutputWindow::setRepository(workingDirectory); - VcsCommand *command = vcsExec(workingDirectory, statusArgs, 0, true); + VcsCommand *command = vcsExec(workingDirectory, { "status", "-u" }, nullptr, true); connect(command, &VcsCommand::finished, VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository, Qt::QueuedConnection); } @@ -849,13 +835,10 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName, editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); editor->setWorkingDirectory(workingDir); - QStringList arguments; - arguments << QLatin1String("log") << QLatin1String(noColorOption) - << QLatin1String(decorateOption); - + QStringList arguments = { "log", noColorOption, decorateOption }; int logCount = settings().intValue(GitSettings::logCountKey); if (logCount > 0) - arguments << QLatin1String("-n") << QString::number(logCount); + arguments << "-n" << QString::number(logCount); auto *argWidget = editor->configurationWidget(); argWidget->setBaseArguments(args); @@ -864,7 +847,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName, arguments.append(userArgs); if (!fileName.isEmpty()) - arguments << QLatin1String("--follow") << QLatin1String("--") << fileName; + arguments << "--follow" << "--" << fileName; vcsExec(workingDir, arguments, editor); } @@ -877,13 +860,10 @@ void GitClient::reflog(const QString &workingDirectory) "reflogRepository", workingDirectory); editor->setWorkingDirectory(workingDirectory); - QStringList arguments; - arguments << QLatin1String("reflog") << QLatin1String(noColorOption) - << QLatin1String(decorateOption); - + QStringList arguments = { "reflog", noColorOption, decorateOption }; int logCount = settings().intValue(GitSettings::logCountKey); if (logCount > 0) - arguments << QLatin1String("-n") << QString::number(logCount); + arguments << "-n" << QString::number(logCount); vcsExec(workingDirectory, arguments, editor); } @@ -891,11 +871,7 @@ void GitClient::reflog(const QString &workingDirectory) // Do not show "0000" or "^32ae4" static inline bool canShow(const QString &sha) { - if (sha.startsWith(QLatin1Char('^'))) - return false; - if (sha.count(QLatin1Char('0')) == sha.size()) - return false; - return true; + return !sha.startsWith('^') && sha.count('0') != sha.size(); } static inline QString msgCannotShow(const QString &sha) @@ -949,10 +925,9 @@ VcsBaseEditorWidget *GitClient::annotate( } editor->setWorkingDirectory(workingDir); - QStringList arguments(QLatin1String("blame")); - arguments << QLatin1String("--root"); + QStringList arguments = { "blame", "--root" }; arguments << editor->configurationWidget()->arguments(); - arguments << QLatin1String("--") << file; + arguments << "--" << file; if (!revision.isEmpty()) arguments << revision; vcsExec(workingDir, arguments, editor, false, 0, lineNumber); @@ -961,7 +936,7 @@ VcsBaseEditorWidget *GitClient::annotate( bool GitClient::synchronousCheckout(const QString &workingDirectory, const QString &ref, - QString *errorMessage /* = 0 */) + QString *errorMessage) { QByteArray outputText; QByteArray errorText; @@ -980,11 +955,9 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory, QStringList GitClient::setupCheckoutArguments(const QString &workingDirectory, const QString &ref) { - QStringList arguments(QLatin1String("checkout")); - arguments << ref; + QStringList arguments = { "checkout", ref }; QStringList localBranches = synchronousRepositoryBranches(workingDirectory); - if (localBranches.contains(ref)) return arguments; @@ -1007,18 +980,17 @@ QStringList GitClient::setupCheckoutArguments(const QString &workingDirectory, return arguments; QString output; - QStringList forEachRefArgs(QLatin1String("refs/remotes/")); - forEachRefArgs << QLatin1String("--format=%(objectname) %(refname:short)"); + const QStringList forEachRefArgs = { "refs/remotes/", "--format=%(objectname) %(refname:short)" }; if (!synchronousForEachRefCmd(workingDirectory, forEachRefArgs, &output)) return arguments; QString remoteBranch; - const QString head(QLatin1String("/HEAD")); + const QString head("/HEAD"); - foreach (const QString &singleRef, output.split(QLatin1Char('\n'))) { + foreach (const QString &singleRef, output.split('\n')) { if (singleRef.startsWith(refSha)) { // branch name might be origin/foo/HEAD - if (!singleRef.endsWith(head) || singleRef.count(QLatin1Char('/')) > 1) { + if (!singleRef.endsWith(head) || singleRef.count('/') > 1) { remoteBranch = singleRef.mid(refSha.length() + 1); if (remoteBranch == ref) break; @@ -1033,24 +1005,23 @@ QStringList GitClient::setupCheckoutArguments(const QString &workingDirectory, return arguments; arguments.removeLast(); - arguments << QLatin1String("-b") << branchAddDialog.branchName(); + arguments << "-b" << branchAddDialog.branchName(); if (branchAddDialog.track()) - arguments << QLatin1String("--track") << remoteBranch; + arguments << "--track" << remoteBranch; else - arguments << QLatin1String("--no-track") << ref; + arguments << "--no-track" << ref; return arguments; } void GitClient::reset(const QString &workingDirectory, const QString &argument, const QString &commit) { - QStringList arguments; - arguments << QLatin1String("reset") << argument; + QStringList arguments = { "reset", argument }; if (!commit.isEmpty()) arguments << commit; unsigned flags = 0; - if (argument == QLatin1String("--hard")) { + if (argument == "--hard") { if (gitStatus(workingDirectory, StatusMode(NoUntracked | NoSubmodules)) != StatusUnchanged) { if (QMessageBox::question( Core::ICore::mainWindow(), tr("Reset"), @@ -1062,15 +1033,12 @@ void GitClient::reset(const QString &workingDirectory, const QString &argument, } flags |= VcsCommand::ExpectRepoChanges; } - vcsExec(workingDirectory, arguments, 0, true, flags); + vcsExec(workingDirectory, arguments, nullptr, true, flags); } void GitClient::addFile(const QString &workingDirectory, const QString &fileName) { - QStringList arguments; - arguments << QLatin1String("add") << fileName; - - vcsExec(workingDirectory, arguments); + vcsExec(workingDirectory, { "add", fileName }); } bool GitClient::synchronousLog(const QString &workingDirectory, const QStringList &arguments, @@ -1078,8 +1046,8 @@ bool GitClient::synchronousLog(const QString &workingDirectory, const QStringLis { QByteArray outputData; QByteArray errorData; - QStringList allArguments; - allArguments << QLatin1String("log") << QLatin1String(noColorOption); + QStringList allArguments = { "log", noColorOption }; + allArguments.append(arguments); const bool rc = vcsFullySynchronousExec(workingDirectory, allArguments, &outputData, &errorData, flags); if (rc) { @@ -1099,9 +1067,7 @@ bool GitClient::synchronousLog(const QString &workingDirectory, const QStringLis bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringList &files) { QByteArray outputText; - QStringList arguments; - arguments << QLatin1String("add") << files; - return vcsFullySynchronousExec(workingDirectory, arguments, &outputText); + return vcsFullySynchronousExec(workingDirectory, QStringList({ "add" }) + files, &outputText); } bool GitClient::synchronousDelete(const QString &workingDirectory, @@ -1109,10 +1075,9 @@ bool GitClient::synchronousDelete(const QString &workingDirectory, const QStringList &files) { QByteArray outputText; - QStringList arguments; - arguments << QLatin1String("rm"); + QStringList arguments = { "rm" }; if (force) - arguments << QLatin1String("--force"); + arguments << "--force"; arguments.append(files); return vcsFullySynchronousExec(workingDirectory, arguments, &outputText); } @@ -1122,11 +1087,7 @@ bool GitClient::synchronousMove(const QString &workingDirectory, const QString &to) { QByteArray outputText; - QStringList arguments; - arguments << QLatin1String("mv"); - arguments << (from); - arguments << (to); - return vcsFullySynchronousExec(workingDirectory, arguments, &outputText); + return vcsFullySynchronousExec(workingDirectory, { "mv", from, to }, &outputText); } bool GitClient::synchronousReset(const QString &workingDirectory, @@ -1135,20 +1096,18 @@ bool GitClient::synchronousReset(const QString &workingDirectory, { QByteArray outputText; QByteArray errorText; - QStringList arguments; - arguments << QLatin1String("reset"); + QStringList arguments = { "reset" }; if (files.isEmpty()) - arguments << QLatin1String("--hard"); + arguments << "--hard"; else - arguments << QLatin1String(HEAD) << QLatin1String("--") << files; + arguments << HEAD << "--" << files; const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText); const QString output = commandOutputFromLocal8Bit(outputText); VcsOutputWindow::append(output); // Note that git exits with 1 even if the operation is successful // Assume real failure if the output does not contain "foo.cpp modified" // or "Unstaged changes after reset" (git 1.7.0). - if (!rc && (!output.contains(QLatin1String("modified")) - && !output.contains(QLatin1String("Unstaged changes after reset")))) { + if (!rc && (!output.contains("modified") && !output.contains("Unstaged changes after reset"))) { if (files.isEmpty()) { msgCannotRun(arguments, workingDirectory, errorText, errorMessage); } else { @@ -1166,8 +1125,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory, bool GitClient::synchronousInit(const QString &workingDirectory) { QByteArray outputText; - const QStringList arguments(QLatin1String("init")); - const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText); + const bool rc = vcsFullySynchronousExec(workingDirectory, { "init" }, &outputText); // '[Re]Initialized...' VcsOutputWindow::append(commandOutputFromLocal8Bit(outputText)); if (rc) @@ -1179,27 +1137,24 @@ bool GitClient::synchronousInit(const QString &workingDirectory) * git checkout -- <files> * git checkout revision -- <files> * git checkout revision -- . */ -bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory, - QStringList files /* = QStringList() */, - QString revision /* = QString() */, - QString *errorMessage /* = 0 */, - bool revertStaging /* = true */) +bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory, QStringList files, + QString revision, QString *errorMessage, + bool revertStaging) { if (revertStaging && revision.isEmpty()) - revision = QLatin1String(HEAD); + revision = HEAD; if (files.isEmpty()) - files = QStringList(QString(QLatin1Char('.'))); + files = QStringList("."); QByteArray outputText; QByteArray errorText; - QStringList arguments; - arguments << QLatin1String("checkout"); + QStringList arguments = { "checkout" }; if (revertStaging) arguments << revision; - arguments << QLatin1String("--") << files; + arguments << "--" << files; const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText, VcsCommand::ExpectRepoChanges); if (!rc) { - const QString fileArg = files.join(QLatin1String(", ")); + const QString fileArg = files.join(", "); //: Meaning of the arguments: %1: revision, %2: files, %3: repository, //: %4: Error message msgCannotRun(tr("Cannot checkout \"%1\" of %2 in \"%3\": %4") @@ -1213,7 +1168,7 @@ bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory, bool GitClient::stashAndCheckout(const QString &workingDirectory, const QString &ref) { - if (!beginStashScope(workingDirectory, QLatin1String("Checkout"))) + if (!beginStashScope(workingDirectory, "Checkout")) return false; if (!synchronousCheckout(workingDirectory, ref)) return false; @@ -1236,14 +1191,14 @@ static inline QString msgInvalidRevision() // Split a line of "<commit> <parent1> ..." to obtain parents from "rev-list" or "log". static inline bool splitCommitParents(const QString &line, - QString *commit = 0, - QStringList *parents = 0) + QString *commit = nullptr, + QStringList *parents = nullptr) { if (commit) commit->clear(); if (parents) parents->clear(); - QStringList tokens = line.trimmed().split(QLatin1Char(' ')); + QStringList tokens = line.trimmed().split(' '); if (tokens.size() < 2) return false; if (commit) @@ -1254,19 +1209,16 @@ static inline bool splitCommitParents(const QString &line, return true; } -bool GitClient::synchronousRevListCmd(const QString &workingDirectory, const QStringList &arguments, +bool GitClient::synchronousRevListCmd(const QString &workingDirectory, const QStringList &extraArguments, QString *output, QString *errorMessage) const { QByteArray outputTextData; QByteArray errorText; - - QStringList args(QLatin1String("rev-list")); - args << QLatin1String(noColorOption) << arguments; - - const bool rc = vcsFullySynchronousExec(workingDirectory, args, &outputTextData, &errorText, - silentFlags); + const QStringList arguments = QStringList({ "rev-list", noColorOption }) + extraArguments; + const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputTextData, + &errorText, silentFlags); if (!rc) { - msgCannotRun(args, workingDirectory, errorText, errorMessage); + msgCannotRun(arguments, workingDirectory, errorText, errorMessage); return false; } *output = commandOutputFromLocal8Bit(outputTextData); @@ -1280,23 +1232,21 @@ bool GitClient::synchronousParentRevisions(const QString &workingDirectory, QStringList *parents, QString *errorMessage) const { - QString outputText; - QString errorText; - QStringList arguments; if (parents && !isValidRevision(revision)) { // Not Committed Yet - *parents = QStringList(QLatin1String(HEAD)); + *parents = QStringList(HEAD); return true; } - arguments << QLatin1String("--parents") << QLatin1String("--max-count=1") << revision; - - if (!synchronousRevListCmd(workingDirectory, arguments, &outputText, &errorText)) { + QString outputText; + QString errorText; + if (!synchronousRevListCmd(workingDirectory, { "--parents", "--max-count=1", revision }, + &outputText, &errorText)) { *errorMessage = msgParentRevisionFailed(workingDirectory, revision, errorText); return false; } // Should result in one line of blank-delimited revisions, specifying current first // unless it is top. - outputText.remove(QLatin1Char('\n')); - if (!splitCommitParents(outputText, 0, parents)) { + outputText.remove('\n'); + if (!splitCommitParents(outputText, nullptr, parents)) { *errorMessage = msgParentRevisionFailed(workingDirectory, revision, msgInvalidRevision()); return false; } @@ -1310,14 +1260,13 @@ static const int maxShortLogLength = 120; QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision) const { // Short SHA 1, author, subject - QString output = synchronousShortDescription(workingDirectory, revision, - QLatin1String(defaultShortLogFormatC)); + QString output = synchronousShortDescription(workingDirectory, revision, defaultShortLogFormatC); if (output != revision) { if (output.length() > maxShortLogLength) { output.truncate(maxShortLogLength); - output.append(QLatin1String("...")); + output.append("..."); } - output.append(QLatin1String("\")")); + output.append("\")"); } return output; } @@ -1325,20 +1274,19 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory, QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory) const { QByteArray outputTextData; - QStringList arguments; QString branch; - arguments << QLatin1String("symbolic-ref") << QLatin1String(HEAD); - if (vcsFullySynchronousExec(workingDirectory, arguments, &outputTextData, 0, silentFlags)) { + if (vcsFullySynchronousExec(workingDirectory, { "symbolic-ref", HEAD }, &outputTextData, 0, + silentFlags)) { branch = commandOutputFromLocal8Bit(outputTextData.trimmed()); } else { const QString gitDir = findGitDirForRepository(workingDirectory); - const QString rebaseHead = gitDir + QLatin1String("/rebase-merge/head-name"); + const QString rebaseHead = gitDir + "/rebase-merge/head-name"; QFile head(rebaseHead); if (head.open(QFile::ReadOnly)) branch = QString::fromUtf8(head.readLine()).trimmed(); } if (!branch.isEmpty()) { - const QString refsHeadsPrefix = QLatin1String("refs/heads/"); + const QString refsHeadsPrefix = "refs/heads/"; if (branch.startsWith(refsHeadsPrefix)) { branch.remove(0, refsHeadsPrefix.count()); return branch; @@ -1350,15 +1298,13 @@ QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList *output, QString *errorMessage) const { - QStringList args; - args << QLatin1String("show-ref") << QLatin1String("--head") - << QLatin1String("--abbrev=10") << QLatin1String("--dereference"); + const QStringList arguments = { "show-ref", "--head", "--abbrev=10", "--dereference" }; QByteArray outputText; QByteArray errorText; - const bool rc = vcsFullySynchronousExec(workingDirectory, args, &outputText, &errorText, + const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText, silentFlags); if (!rc) { - msgCannotRun(args, workingDirectory, errorText, errorMessage); + msgCannotRun(arguments, workingDirectory, errorText, errorMessage); return false; } @@ -1392,9 +1338,9 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const if (!synchronousHeadRefs(workingDirectory, &references)) return QString(); - const QString tagStart(QLatin1String("refs/tags/")); - const QString remoteStart(QLatin1String("refs/remotes/")); - const QString dereference(QLatin1String("^{}")); + const QString tagStart("refs/tags/"); + const QString remoteStart("refs/remotes/"); + const QString dereference("^{}"); QString remoteBranch; foreach (const QString &ref, references) { @@ -1411,9 +1357,7 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const // No tag or remote branch - try git describe QByteArray output; - QStringList arguments; - arguments << QLatin1String("describe"); - if (vcsFullySynchronousExec(workingDirectory, arguments, &output, 0, VcsCommand::NoOutput)) { + if (vcsFullySynchronousExec(workingDirectory, { "describe" }, &output, 0, VcsCommand::NoOutput)) { const QString describeOutput = commandOutputFromLocal8Bit(output.trimmed()); if (!describeOutput.isEmpty()) return describeOutput; @@ -1424,8 +1368,7 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QString &ref, QString *output, QString *errorMessage) const { - QStringList arguments(QLatin1String("rev-parse")); - arguments << ref; + const QStringList arguments = { "rev-parse", ref }; QByteArray outputText; QByteArray errorText; const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText, @@ -1441,7 +1384,7 @@ bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QS QString GitClient::synchronousTopRevision(const QString &workingDirectory, QString *errorMessageIn) { QString revision; - if (!synchronousRevParseCmd(workingDirectory, QLatin1String(HEAD), &revision, errorMessageIn)) + if (!synchronousRevParseCmd(workingDirectory, HEAD, &revision, errorMessageIn)) return QString(); return revision; @@ -1451,9 +1394,8 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const QString &precedes, QString &follows) const { QByteArray pr; - QStringList arguments; - arguments << QLatin1String("describe") << QLatin1String("--contains") << revision; - vcsFullySynchronousExec(workingDirectory, arguments, &pr, 0, silentFlags); + vcsFullySynchronousExec(workingDirectory, { "describe", "--contains", revision }, + &pr, 0, silentFlags); int tilde = pr.indexOf('~'); if (tilde != -1) pr.truncate(tilde); @@ -1466,14 +1408,12 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const synchronousParentRevisions(workingDirectory, revision, &parents, &errorMessage); foreach (const QString &p, parents) { QByteArray pf; - arguments.clear(); - arguments << QLatin1String("describe") << QLatin1String("--tags") - << QLatin1String("--abbrev=0") << p; - vcsFullySynchronousExec(workingDirectory, arguments, &pf, 0, silentFlags); + vcsFullySynchronousExec(workingDirectory, { "describe", "--tags", "--abbrev=0", p }, + &pf, 0, silentFlags); pf.truncate(pf.lastIndexOf('\n')); if (!pf.isEmpty()) { if (!follows.isEmpty()) - follows += QLatin1String(", "); + follows += ", "; follows += QString::fromLocal8Bit(pf); } } @@ -1481,33 +1421,28 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const void GitClient::branchesForCommit(const QString &revision) { - QStringList arguments; - arguments << QLatin1String("branch") << QLatin1String(noColorOption) - << QLatin1String("-a") << QLatin1String("--contains") << revision; - auto controller = qobject_cast<DiffEditorController *>(sender()); QString workingDirectory = controller->baseDirectory(); - VcsCommand *command = vcsExec(workingDirectory, arguments, 0, false, 0, workingDirectory); + VcsCommand *command = vcsExec( + workingDirectory, { "branch", noColorOption, "-a", "--contains", revision}, nullptr, + false, 0, workingDirectory); connect(command, &VcsCommand::stdOutText, controller, &DiffEditorController::informationForCommitReceived); } bool GitClient::isRemoteCommit(const QString &workingDirectory, const QString &commit) { - QStringList arguments; QByteArray outputText; - arguments << QLatin1String("branch") << QLatin1String("-r") - << QLatin1String("--contains") << commit; - vcsFullySynchronousExec(workingDirectory, arguments, &outputText, 0, silentFlags); + vcsFullySynchronousExec(workingDirectory, { "branch", "-r", "--contains", commit }, + &outputText, 0, silentFlags); return !outputText.isEmpty(); } bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QString &branch) { - QStringList arguments; QByteArray outputText; - arguments << QLatin1String("merge-base") << QLatin1String(HEAD) << branch; - vcsFullySynchronousExec(workingDirectory, arguments, &outputText, 0, silentFlags); + vcsFullySynchronousExec(workingDirectory, { "merge-base", HEAD, branch }, + &outputText, 0, silentFlags); return commandOutputFromLocal8Bit(outputText).trimmed() == synchronousTopRevision(workingDirectory); } @@ -1519,10 +1454,8 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory, QString description; QByteArray outputTextData; QByteArray errorText; - QStringList arguments; - arguments << QLatin1String("log") << QLatin1String(noColorOption) - << (QLatin1String("--pretty=format:") + format) - << QLatin1String("--max-count=1") << revision; + const QStringList arguments = { "log", noColorOption, ("--pretty=format:" + format), + "--max-count=1", revision }; const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputTextData, &errorText, silentFlags); if (!rc) { @@ -1531,7 +1464,7 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory, return revision; } description = commandOutputFromLocal8Bit(outputTextData); - if (description.endsWith(QLatin1Char('\n'))) + if (description.endsWith('\n')) description.truncate(description.size() - 1); return description; } @@ -1539,12 +1472,9 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory, // Create a default message to be used for describing stashes static inline QString creatorStashMessage(const QString &keyword = QString()) { - QString rc = QCoreApplication::applicationName(); - rc += QLatin1Char(' '); - if (!keyword.isEmpty()) { - rc += keyword; - rc += QLatin1Char(' '); - } + QString rc = QCoreApplication::applicationName() + ' '; + if (!keyword.isEmpty()) + rc += keyword + ' '; rc += QDateTime::currentDateTime().toString(Qt::ISODate); return rc; } @@ -1564,7 +1494,7 @@ QString GitClient::synchronousStash(const QString &workingDirectory, const QStri bool success = false; // Check for changes and stash QString errorMessage; - switch (gitStatus(workingDirectory, StatusMode(NoUntracked | NoSubmodules), 0, &errorMessage)) { + switch (gitStatus(workingDirectory, StatusMode(NoUntracked | NoSubmodules), nullptr, &errorMessage)) { case StatusChanged: { message = creatorStashMessage(messageKeyword); do { @@ -1576,7 +1506,7 @@ QString GitClient::synchronousStash(const QString &workingDirectory, const QStri if (!executeSynchronousStash(workingDirectory, message)) break; if ((flags & StashImmediateRestore) - && !synchronousStashRestore(workingDirectory, QLatin1String("stash@{0}"))) + && !synchronousStashRestore(workingDirectory, "stash@{0}")) break; success = true; } while (false); @@ -1602,10 +1532,9 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory, bool unstagedOnly, QString *errorMessage) const { - QStringList arguments; - arguments << QLatin1String("stash") << QLatin1String("save"); + QStringList arguments = { "stash", "save" }; if (unstagedOnly) - arguments << QLatin1String("--keep-index"); + arguments << "--keep-index"; if (!message.isEmpty()) arguments << message; const unsigned flags = VcsCommand::ShowStdOut @@ -1648,7 +1577,7 @@ bool GitClient::stashNameFromMessage(const QString &workingDirectory, bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs, QString *output, QString *errorMessage) const { - branchArgs.push_front(QLatin1String("branch")); + branchArgs.push_front("branch"); QByteArray outputText; QByteArray errorText; const bool rc = vcsFullySynchronousExec(workingDirectory, branchArgs, &outputText, &errorText); @@ -1662,7 +1591,7 @@ bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringLis bool GitClient::synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs, QString *output, QString *errorMessage) const { - tagArgs.push_front(QLatin1String("tag")); + tagArgs.push_front("tag"); QByteArray outputText; QByteArray errorText; const bool rc = vcsFullySynchronousExec(workingDirectory, tagArgs, &outputText, &errorText); @@ -1676,7 +1605,7 @@ bool GitClient::synchronousTagCmd(const QString &workingDirectory, QStringList t bool GitClient::synchronousForEachRefCmd(const QString &workingDirectory, QStringList args, QString *output, QString *errorMessage) const { - args.push_front(QLatin1String("for-each-ref")); + args.push_front("for-each-ref"); QByteArray outputText; QByteArray errorText; const bool rc = vcsFullySynchronousExec(workingDirectory, args, &outputText, &errorText, @@ -1690,14 +1619,14 @@ bool GitClient::synchronousForEachRefCmd(const QString &workingDirectory, QStrin VcsCommand *GitClient::asyncForEachRefCmd(const QString &workingDirectory, QStringList args) const { - args.push_front(QLatin1String("for-each-ref")); - return vcsExec(workingDirectory, args, 0, false, silentFlags); + args.push_front("for-each-ref"); + return vcsExec(workingDirectory, args, nullptr, false, silentFlags); } bool GitClient::synchronousRemoteCmd(const QString &workingDirectory, QStringList remoteArgs, QString *output, QString *errorMessage, bool silent) const { - remoteArgs.push_front(QLatin1String("remote")); + remoteArgs.push_front("remote"); QByteArray outputText; QByteArray errorText; if (!vcsFullySynchronousExec(workingDirectory, remoteArgs, &outputText, &errorText, @@ -1716,18 +1645,17 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDi QMap<QString,QString> result; QString output; QString error; - QStringList args(QLatin1String("-v")); - if (!synchronousRemoteCmd(workingDirectory, args, &output, &error, true)) { + if (!synchronousRemoteCmd(workingDirectory, { "-v" }, &output, &error, true)) { msgCannotRun(error, errorMessage); return result; } - QStringList remotes = output.split(QLatin1String("\n")); + QStringList remotes = output.split("\n"); foreach (const QString &remote, remotes) { - if (!remote.endsWith(QLatin1String(" (push)"))) + if (!remote.endsWith(" (push)")) continue; - int tabIndex = remote.indexOf(QLatin1Char('\t')); + const int tabIndex = remote.indexOf('\t'); if (tabIndex == -1) continue; QString url = remote.mid(tabIndex + 1, remote.length() - tabIndex - 8); @@ -1741,12 +1669,9 @@ QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirector { QByteArray outputTextData; QByteArray errorText; - QStringList arguments; - // get submodule status - arguments << QLatin1String("submodule") << QLatin1String("status"); - if (!vcsFullySynchronousExec(workingDirectory, arguments, &outputTextData, &errorText, - silentFlags)) { + if (!vcsFullySynchronousExec(workingDirectory, { "submodule", "status" }, + &outputTextData, &errorText, silentFlags)) { msgCannotRun(tr("Cannot retrieve submodule status of \"%1\": %2") .arg(QDir::toNativeSeparators(workingDirectory), commandOutputFromLocal8Bit(errorText)), errorMessage); @@ -1758,7 +1683,7 @@ QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirector SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) const { SubmoduleDataMap result; - QString gitmodulesFileName = workingDirectory + QLatin1String("/.gitmodules"); + QString gitmodulesFileName = workingDirectory + "/.gitmodules"; if (!QFile::exists(gitmodulesFileName)) return result; @@ -1767,15 +1692,15 @@ SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) const if (cachedSubmoduleData.contains(workingDirectory)) return cachedSubmoduleData.value(workingDirectory); - QStringList allConfigs = readConfigValue(workingDirectory, QLatin1String("-l")) - .split(QLatin1Char('\n')); - const QString submoduleLineStart = QLatin1String("submodule."); + QStringList allConfigs = readConfigValue(workingDirectory, "-l") + .split('\n'); + const QString submoduleLineStart = "submodule."; foreach (const QString &configLine, allConfigs) { if (!configLine.startsWith(submoduleLineStart)) continue; int nameStart = submoduleLineStart.size(); - int nameEnd = configLine.indexOf(QLatin1Char('.'), nameStart); + int nameEnd = configLine.indexOf('.', nameStart); QString submoduleName = configLine.mid(nameStart, nameEnd - nameStart); @@ -1783,9 +1708,9 @@ SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) const if (result.contains(submoduleName)) submoduleData = result[submoduleName]; - if (configLine.mid(nameEnd, 5) == QLatin1String(".url=")) + if (configLine.mid(nameEnd, 5) == ".url=") submoduleData.url = configLine.mid(nameEnd + 5); - else if (configLine.mid(nameEnd, 8) == QLatin1String(".ignore=")) + else if (configLine.mid(nameEnd, 8) == ".ignore=") submoduleData.ignore = configLine.mid(nameEnd + 8); else continue; @@ -1798,15 +1723,14 @@ SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) const QSettings gitmodulesFile(gitmodulesFileName, QSettings::IniFormat); foreach (const QString &submoduleName, result.keys()) { - gitmodulesFile.beginGroup(QLatin1String("submodule \"") + - submoduleName + QLatin1Char('"')); - const QString path = gitmodulesFile.value(QLatin1String("path")).toString(); + gitmodulesFile.beginGroup("submodule \"" + submoduleName + '"'); + const QString path = gitmodulesFile.value("path").toString(); if (path.isEmpty()) { // invalid submodule entry in config result.remove(submoduleName); } else { SubmoduleData &submoduleRef = result[submoduleName]; submoduleRef.dir = path; - QString ignore = gitmodulesFile.value(QLatin1String("ignore")).toString(); + QString ignore = gitmodulesFile.value("ignore").toString(); if (!ignore.isEmpty() && submoduleRef.ignore.isEmpty()) submoduleRef.ignore = ignore; } @@ -1825,12 +1749,11 @@ bool GitClient::synchronousShow(const QString &workingDirectory, const QString & *errorMessage = msgCannotShow(id); return false; } - QStringList args(QLatin1String("show")); - args << QLatin1String(decorateOption) << QLatin1String(noColorOption) << id; + const QStringList arguments = { "show", decorateOption, noColorOption, id }; QByteArray errorText; - const bool rc = vcsFullySynchronousExec(workingDirectory, args, output, &errorText); + const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, output, &errorText); if (!rc) - msgCannotRun(QStringList(QLatin1String("show")), workingDirectory, errorText, errorMessage); + msgCannotRun(arguments, workingDirectory, errorText, errorMessage); return rc; } @@ -1838,23 +1761,22 @@ bool GitClient::synchronousShow(const QString &workingDirectory, const QString & bool GitClient::cleanList(const QString &workingDirectory, const QString &modulePath, const QString &flag, QStringList *files, QString *errorMessage) { - const QString directory = workingDirectory + QLatin1Char('/') + modulePath; - QStringList args; - args << QLatin1String("clean") << QLatin1String("--dry-run") << flag; + const QString directory = workingDirectory + '/' + modulePath; + const QStringList arguments = { "clean", "--dry-run", flag }; QByteArray outputText; QByteArray errorText; - const bool rc = vcsFullySynchronousExec(directory, args, &outputText, &errorText); + const bool rc = vcsFullySynchronousExec(directory, arguments, &outputText, &errorText); if (!rc) { - msgCannotRun(QStringList(QLatin1String("clean")), directory, - errorText, errorMessage); + msgCannotRun(arguments, directory, errorText, errorMessage); return false; } // Filter files that git would remove - const QString relativeBase = modulePath.isEmpty() ? QString() : modulePath + QLatin1Char('/'); - const QString prefix = QLatin1String("Would remove "); - foreach (const QString &line, commandOutputLinesFromLocal8Bit(outputText)) + const QString relativeBase = modulePath.isEmpty() ? QString() : modulePath + '/'; + const QString prefix = "Would remove "; + foreach (const QString &line, commandOutputLinesFromLocal8Bit(outputText)) { if (line.startsWith(prefix)) files->push_back(relativeBase + line.mid(prefix.size())); + } return true; } @@ -1862,15 +1784,15 @@ bool GitClient::synchronousCleanList(const QString &workingDirectory, const QStr QStringList *files, QStringList *ignoredFiles, QString *errorMessage) { - bool res = cleanList(workingDirectory, modulePath, QLatin1String("-df"), files, errorMessage); - res &= cleanList(workingDirectory, modulePath, QLatin1String("-dXf"), ignoredFiles, errorMessage); + bool res = cleanList(workingDirectory, modulePath, "-df", files, errorMessage); + res &= cleanList(workingDirectory, modulePath, "-dXf", ignoredFiles, errorMessage); - SubmoduleDataMap submodules = submoduleList(workingDirectory + QLatin1Char('/') + modulePath); + SubmoduleDataMap submodules = submoduleList(workingDirectory + '/' + modulePath); foreach (const SubmoduleData &submodule, submodules) { - if (submodule.ignore != QLatin1String("all") - && submodule.ignore != QLatin1String("dirty")) { + if (submodule.ignore != "all" + && submodule.ignore != "dirty") { const QString submodulePath = modulePath.isEmpty() ? submodule.dir - : modulePath + QLatin1Char('/') + submodule.dir; + : modulePath + '/' + submodule.dir; res &= synchronousCleanList(workingDirectory, submodulePath, files, ignoredFiles, errorMessage); } @@ -1880,13 +1802,13 @@ bool GitClient::synchronousCleanList(const QString &workingDirectory, const QStr bool GitClient::synchronousApplyPatch(const QString &workingDirectory, const QString &file, QString *errorMessage, - const QStringList &arguments) + const QStringList &extraArguments) { - QStringList args; - args << QLatin1String("apply") << QLatin1String("--whitespace=fix") << arguments << file; + QStringList arguments = { "apply", "--whitespace=fix" }; + arguments << extraArguments << file; QByteArray outputText; QByteArray errorText; - const bool rc = vcsFullySynchronousExec(workingDirectory, args, &outputText, &errorText); + const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText); if (rc) { if (!errorText.isEmpty()) *errorMessage = tr("There were warnings while applying \"%1\" to \"%2\":\n%3") @@ -1905,14 +1827,14 @@ QProcessEnvironment GitClient::processEnvironment() const QString gitPath = settings().stringValue(GitSettings::pathKey); if (!gitPath.isEmpty()) { gitPath += HostOsInfo::pathListSeparator(); - gitPath += environment.value(QLatin1String("PATH")); - environment.insert(QLatin1String("PATH"), gitPath); + gitPath += environment.value("PATH"); + environment.insert("PATH", gitPath); } if (HostOsInfo::isWindowsHost() && settings().boolValue(GitSettings::winSetHomeEnvironmentKey)) { - environment.insert(QLatin1String("HOME"), QDir::toNativeSeparators(QDir::homePath())); + environment.insert("HOME", QDir::toNativeSeparators(QDir::homePath())); } - environment.insert(QLatin1String("GIT_EDITOR"), m_disableEditor ? QLatin1String("true") : m_gitQtcEditor); + environment.insert("GIT_EDITOR", m_disableEditor ? "true" : m_gitQtcEditor); return environment; } @@ -1945,7 +1867,7 @@ bool GitClient::isValidRevision(const QString &revision) const if (revision.length() < 1) return false; for (int i = 0; i < revision.length(); ++i) - if (revision.at(i) != QLatin1Char('0')) + if (revision.at(i) != '0') return true; return false; } @@ -1961,7 +1883,7 @@ void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool p bool updateNeeded = false; foreach (const QString &status, submoduleStatus) { - if (status.startsWith(QLatin1Char('+'))) { + if (status.startsWith('+')) { updateNeeded = true; break; } @@ -1978,16 +1900,15 @@ void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool p foreach (const QString &statusLine, submoduleStatus) { // stash only for lines starting with + // because only they would be updated - if (!statusLine.startsWith(QLatin1Char('+'))) + if (!statusLine.startsWith('+')) continue; // get submodule name - const int nameStart = statusLine.indexOf(QLatin1Char(' '), 2) + 1; - const int nameLength = statusLine.indexOf(QLatin1Char(' '), nameStart) - nameStart; - const QString submoduleDir = workingDirectory + QLatin1Char('/') - + statusLine.mid(nameStart, nameLength); + const int nameStart = statusLine.indexOf(' ', 2) + 1; + const int nameLength = statusLine.indexOf(' ', nameStart) - nameStart; + const QString submoduleDir = workingDirectory + '/' + statusLine.mid(nameStart, nameLength); - if (beginStashScope(submoduleDir, QLatin1String("SubmoduleUpdate"))) { + if (beginStashScope(submoduleDir, "SubmoduleUpdate")) { m_updatedSubmodules.append(submoduleDir); } else { finishSubmoduleUpdate(); @@ -1995,10 +1916,7 @@ void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool p } } - QStringList arguments; - arguments << QLatin1String("submodule") << QLatin1String("update"); - - VcsCommand *cmd = vcsExec(workingDirectory, arguments, 0, true, + VcsCommand *cmd = vcsExec(workingDirectory, { "submodule", "update" }, nullptr, true, VcsCommand::ExpectRepoChanges); connect(cmd, &VcsCommand::finished, this, &GitClient::finishSubmoduleUpdate); } @@ -2016,18 +1934,16 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, St // Run 'status'. Note that git returns exitcode 1 if there are no added files. QByteArray outputText; QByteArray errorText; - - QStringList statusArgs; - statusArgs << QLatin1String("status"); + QStringList arguments = { "status" }; if (mode & NoUntracked) - statusArgs << QLatin1String("--untracked-files=no"); + arguments << "--untracked-files=no"; else - statusArgs << QLatin1String("--untracked-files=all"); + arguments << "--untracked-files=all"; if (mode & NoSubmodules) - statusArgs << QLatin1String("--ignore-submodules=all"); - statusArgs << QLatin1String("--porcelain") << QLatin1String("-b"); + arguments << "--ignore-submodules=all"; + arguments << "--porcelain" << "-b"; - const bool statusRc = vcsFullySynchronousExec(workingDirectory, statusArgs, + const bool statusRc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText, silentFlags); if (output) *output = commandOutputFromLocal8Bit(outputText); @@ -2072,15 +1988,15 @@ QString GitClient::commandInProgressDescription(const QString &workingDirectory) GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &workingDirectory) const { const QString gitDir = findGitDirForRepository(workingDirectory); - if (QFile::exists(gitDir + QLatin1String("/MERGE_HEAD"))) + if (QFile::exists(gitDir + "/MERGE_HEAD")) return Merge; - else if (QFile::exists(gitDir + QLatin1String("/rebase-apply/rebasing"))) + else if (QFile::exists(gitDir + "/rebase-apply/rebasing")) return Rebase; - else if (QFile::exists(gitDir + QLatin1String("/rebase-merge"))) + else if (QFile::exists(gitDir + "/rebase-merge")) return RebaseMerge; - else if (QFile::exists(gitDir + QLatin1String("/REVERT_HEAD"))) + else if (QFile::exists(gitDir + "/REVERT_HEAD")) return Revert; - else if (QFile::exists(gitDir + QLatin1String("/CHERRY_PICK_HEAD"))) + else if (QFile::exists(gitDir + "/CHERRY_PICK_HEAD")) return CherryPick; else return NoCommand; @@ -2101,22 +2017,22 @@ void GitClient::continueCommandIfNeeded(const QString &workingDirectory, bool al case RebaseMerge: continuePreviousGitCommand(workingDirectory, tr("Continue Rebase"), tr("Rebase is in progress. What do you want to do?"), - tr("Continue"), QLatin1String("rebase"), continueMode); + tr("Continue"), "rebase", continueMode); break; case Merge: continuePreviousGitCommand(workingDirectory, tr("Continue Merge"), tr("You need to commit changes to finish merge.\nCommit now?"), - tr("Commit"), QLatin1String("merge"), continueMode); + tr("Commit"), "merge", continueMode); break; case Revert: continuePreviousGitCommand(workingDirectory, tr("Continue Revert"), tr("You need to commit changes to finish revert.\nCommit now?"), - tr("Commit"), QLatin1String("revert"), continueMode); + tr("Commit"), "revert", continueMode); break; case CherryPick: continuePreviousGitCommand(workingDirectory, tr("Continue Cherry-Picking"), tr("You need to commit changes to finish cherry-picking.\nCommit now?"), - tr("Commit"), QLatin1String("cherry-pick"), continueMode); + tr("Commit"), "cherry-pick", continueMode); break; default: break; @@ -2128,7 +2044,7 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory, const QString &buttonName, const QString &gitCommand, ContinueCommandMode continueMode) { - bool isRebase = gitCommand == QLatin1String("rebase"); + bool isRebase = gitCommand == "rebase"; bool hasChanges = false; switch (continueMode) { case ContinueOnly: @@ -2138,7 +2054,7 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory, hasChanges = gitStatus(workingDirectory, StatusMode(NoUntracked | NoSubmodules)) == GitClient::StatusChanged; if (!hasChanges) - msgBoxText.prepend(tr("No changes found.") + QLatin1Char(' ')); + msgBoxText.prepend(tr("No changes found.") + ' '); break; case SkipOnly: hasChanges = false; @@ -2167,22 +2083,22 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory, QString GitClient::extendedShowDescription(const QString &workingDirectory, const QString &text) const { - if (!text.startsWith(QLatin1String("commit "))) + if (!text.startsWith("commit ")) return text; QString modText = text; QString precedes, follows; - int lastHeaderLine = modText.indexOf(QLatin1String("\n\n")) + 1; + int lastHeaderLine = modText.indexOf("\n\n") + 1; const QString commit = modText.mid(7, 8); synchronousTagsForCommit(workingDirectory, commit, precedes, follows); if (!precedes.isEmpty()) - modText.insert(lastHeaderLine, QLatin1String("Precedes: ") + precedes + QLatin1Char('\n')); + modText.insert(lastHeaderLine, "Precedes: " + precedes + '\n'); if (!follows.isEmpty()) - modText.insert(lastHeaderLine, QLatin1String("Follows: ") + follows + QLatin1Char('\n')); + modText.insert(lastHeaderLine, "Follows: " + follows + '\n'); // Empty line before headers and commit message - const int emptyLine = modText.indexOf(QLatin1String("\n\n")); + const int emptyLine = modText.indexOf("\n\n"); if (emptyLine != -1) - modText.insert(emptyLine, QLatin1Char('\n') + QLatin1String(DiffEditor::Constants::EXPAND_BRANCHES)); + modText.insert(emptyLine, QString('\n') + DiffEditor::Constants::EXPAND_BRANCHES); return modText; } @@ -2193,25 +2109,24 @@ QString GitClient::extendedShowDescription(const QString &workingDirectory, cons QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryURL, const QString &workingDirectory) const { - QStringList arguments(QLatin1String("ls-remote")); - arguments << repositoryURL << QLatin1String(HEAD) << QLatin1String("refs/heads/*"); const unsigned flags = VcsCommand::SshPasswordPrompt | VcsCommand::SuppressStdErr | VcsCommand::SuppressFailMessage; - const SynchronousProcessResponse resp = vcsSynchronousExec(workingDirectory, arguments, flags); + const SynchronousProcessResponse resp = vcsSynchronousExec( + workingDirectory, { "ls-remote", repositoryURL, HEAD, "refs/heads/*" }, flags); QStringList branches; branches << tr("<Detached HEAD>"); QString headSha; // split "82bfad2f51d34e98b18982211c82220b8db049b<tab>refs/heads/master" bool headFound = false; - foreach (const QString &line, resp.stdOut.split(QLatin1Char('\n'))) { - if (line.endsWith(QLatin1String("\tHEAD"))) { + foreach (const QString &line, resp.stdOut.split('\n')) { + if (line.endsWith("\tHEAD")) { QTC_CHECK(headSha.isNull()); - headSha = line.left(line.indexOf(QLatin1Char('\t'))); + headSha = line.left(line.indexOf('\t')); continue; } - const QString pattern = QLatin1String("\trefs/heads/"); + const QString pattern = "\trefs/heads/"; const int pos = line.lastIndexOf(pattern); if (pos != -1) { const QString branchName = line.mid(pos + pattern.count()); @@ -2230,33 +2145,33 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN { const QFileInfo binaryInfo = vcsBinary().toFileInfo(); QDir foundBinDir(binaryInfo.dir()); - const bool foundBinDirIsCmdDir = foundBinDir.dirName() == QLatin1String("cmd"); + const bool foundBinDirIsCmdDir = foundBinDir.dirName() == "cmd"; QProcessEnvironment env = processEnvironment(); if (tryLauchingGitK(env, workingDirectory, fileName, foundBinDir.path())) return; - QString gitkPath = foundBinDir.path() + QLatin1String("/gitk"); + QString gitkPath = foundBinDir.path() + "/gitk"; VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath)); if (foundBinDirIsCmdDir) { foundBinDir.cdUp(); if (tryLauchingGitK(env, workingDirectory, fileName, - foundBinDir.path() + QLatin1String("/bin"))) { + foundBinDir.path() + "/bin")) { return; } - gitkPath = foundBinDir.path() + QLatin1String("/gitk"); + gitkPath = foundBinDir.path() + "/gitk"; VcsOutputWindow::appendSilently(msgCannotLaunch(gitkPath)); } Environment sysEnv = Environment::systemEnvironment(); - const FileName exec = sysEnv.searchInPath(QLatin1String("gitk")); + const FileName exec = sysEnv.searchInPath("gitk"); if (!exec.isEmpty() && tryLauchingGitK(env, workingDirectory, fileName, exec.parentDir().toString())) { return; } - VcsOutputWindow::appendError(msgCannotLaunch(QLatin1String("gitk"))); + VcsOutputWindow::appendError(msgCannotLaunch("gitk")); } void GitClient::launchRepositoryBrowser(const QString &workingDirectory) @@ -2271,12 +2186,12 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, const QString &fileName, const QString &gitBinDirectory) { - QString binary = gitBinDirectory + QLatin1String("/gitk"); + QString binary = gitBinDirectory + "/gitk"; QStringList arguments; if (HostOsInfo::isWindowsHost()) { // If git/bin is in path, use 'wish' shell to run. Otherwise (git/cmd), directly run gitk - QString wish = gitBinDirectory + QLatin1String("/wish"); - if (QFileInfo(wish + QLatin1String(".exe")).exists()) { + QString wish = gitBinDirectory + "/wish"; + if (QFileInfo(wish + ".exe").exists()) { arguments << binary; binary = wish; } @@ -2285,7 +2200,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, if (!gitkOpts.isEmpty()) arguments.append(QtcProcess::splitArgs(gitkOpts, HostOsInfo::hostOs())); if (!fileName.isEmpty()) - arguments << QLatin1String("--") << fileName; + arguments << "--" << fileName; VcsOutputWindow::appendCommand(workingDirectory, FileName::fromString(binary), arguments); // This should always use QProcess::startDetached (as not to kill // the child), but that does not have an environment parameter. @@ -2314,12 +2229,12 @@ bool GitClient::launchGitGui(const QString &workingDirectory) { if (gitBinary.isEmpty()) { success = false; } else { - success = QProcess::startDetached(gitBinary.toString(), QStringList(QLatin1String("gui")), + success = QProcess::startDetached(gitBinary.toString(), { "gui" }, workingDirectory); } if (!success) - VcsOutputWindow::appendError(msgCannotLaunch(QLatin1String("git gui"))); + VcsOutputWindow::appendError(msgCannotLaunch("git gui")); return success; } @@ -2336,8 +2251,8 @@ FileName GitClient::gitBinDirectory() // and the real binaries are in {setup dir}/bin. If cmd is configured in PATH // or in Git settings, return bin instead. if (HostOsInfo::isWindowsHost() - && path.endsWith(QLatin1String("/cmd"), HostOsInfo::fileNameCaseSensitivity())) { - path.replace(path.size() - 3, 3, QLatin1String("bin")); + && path.endsWith("/cmd", HostOsInfo::fileNameCaseSensitivity())) { + path.replace(path.size() - 3, 3, "bin"); } return FileName::fromString(path); } @@ -2375,11 +2290,9 @@ bool GitClient::readDataFromCommit(const QString &repoDirectory, const QString & QString *commitTemplate) { // Get commit data as "SHA1<lf>author<lf>email<lf>message". - QStringList args(QLatin1String("log")); - args << QLatin1String("--max-count=1") << QLatin1String("--pretty=format:%h\n%an\n%ae\n%B"); - args << commit; + const QStringList arguments = { "log", "--max-count=1", "--pretty=format:%h\n%an\n%ae\n%B", commit }; QByteArray outputText; - if (!vcsFullySynchronousExec(repoDirectory, args, &outputText, 0, silentFlags)) { + if (!vcsFullySynchronousExec(repoDirectory, arguments, &outputText, 0, silentFlags)) { if (errorMessage) *errorMessage = tr("Cannot retrieve last commit data of repository \"%1\".").arg(repoDirectory); return false; @@ -2387,7 +2300,7 @@ bool GitClient::readDataFromCommit(const QString &repoDirectory, const QString & QTextCodec *authorCodec = HostOsInfo::isWindowsHost() ? QTextCodec::codecForName("UTF-8") : commitData.commitEncoding; - commitData.amendSHA1 = QString::fromLatin1(shiftLogLine(outputText)); + commitData.amendSHA1 = QLatin1String(shiftLogLine(outputText)); commitData.panelData.author = authorCodec->toUnicode(shiftLogLine(outputText)); commitData.panelData.email = authorCodec->toUnicode(shiftLogLine(outputText)); if (commitTemplate) @@ -2420,10 +2333,7 @@ bool GitClient::getCommitData(const QString &workingDirectory, // Run status. Note that it has exitcode 1 if there are no added files. QString output; if (commitData.commitType == FixupCommit) { - QStringList arguments; - arguments << QLatin1String(HEAD) << QLatin1String("--not") - << QLatin1String("--remotes") << QLatin1String("-n1"); - synchronousLog(repoDirectory, arguments, &output, errorMessage); + synchronousLog(repoDirectory, { HEAD, "--not", "--remotes", "-n1" }, &output, errorMessage); if (output.isEmpty()) { *errorMessage = msgNoCommits(false); return false; @@ -2479,28 +2389,24 @@ bool GitClient::getCommitData(const QString &workingDirectory, // Get the commit template or the last commit message switch (commitData.commitType) { case AmendCommit: { - if (!readDataFromCommit(repoDirectory, QLatin1String(HEAD), commitData, - errorMessage, commitTemplate)) { + if (!readDataFromCommit(repoDirectory, HEAD, commitData, errorMessage, commitTemplate)) return false; - } break; } case SimpleCommit: { bool authorFromCherryPick = false; QDir gitDirectory(gitDir); // For cherry-picked commit, read author data from the commit (but template from MERGE_MSG) - if (gitDirectory.exists(QLatin1String(CHERRY_PICK_HEAD))) { - authorFromCherryPick = readDataFromCommit(repoDirectory, - QLatin1String(CHERRY_PICK_HEAD), - commitData); + if (gitDirectory.exists(CHERRY_PICK_HEAD)) { + authorFromCherryPick = readDataFromCommit(repoDirectory, CHERRY_PICK_HEAD, commitData); commitData.amendSHA1.clear(); } if (!authorFromCherryPick) { // the format is: // Joe Developer <joedev@example.com> unixtimestamp +HHMM - QString author_info = readGitVar(workingDirectory, QLatin1String("GIT_AUTHOR_IDENT")); - int lt = author_info.lastIndexOf(QLatin1Char('<')); - int gt = author_info.lastIndexOf(QLatin1Char('>')); + QString author_info = readGitVar(workingDirectory, "GIT_AUTHOR_IDENT"); + int lt = author_info.lastIndexOf('<'); + int gt = author_info.lastIndexOf('>'); if (gt == -1 || uint(lt) > uint(gt)) { // shouldn't happen! commitData.panelData.author.clear(); @@ -2511,19 +2417,19 @@ bool GitClient::getCommitData(const QString &workingDirectory, } } // Commit: Get the commit template - QString templateFilename = gitDirectory.absoluteFilePath(QLatin1String("MERGE_MSG")); + QString templateFilename = gitDirectory.absoluteFilePath("MERGE_MSG"); if (!QFile::exists(templateFilename)) - templateFilename = gitDirectory.absoluteFilePath(QLatin1String("SQUASH_MSG")); + templateFilename = gitDirectory.absoluteFilePath("SQUASH_MSG"); if (!QFile::exists(templateFilename)) { FileName templateName = FileName::fromUserInput( - readConfigValue(workingDirectory, QLatin1String("commit.template"))); + readConfigValue(workingDirectory, "commit.template")); templateFilename = templateName.toString(); } if (!templateFilename.isEmpty()) { // Make relative to repository const QFileInfo templateFileInfo(templateFilename); if (templateFileInfo.isRelative()) - templateFilename = repoDirectory + QLatin1Char('/') + templateFilename; + templateFilename = repoDirectory + '/' + templateFilename; FileReader reader; if (!reader.fetch(templateFilename, QIODevice::Text, errorMessage)) return false; @@ -2549,9 +2455,9 @@ bool GitClient::getCommitData(const QString &workingDirectory, static inline QString msgCommitted(const QString &amendSHA1, int fileCount) { if (amendSHA1.isEmpty()) - return GitClient::tr("Committed %n file(s).", 0, fileCount) + QLatin1Char('\n'); + return GitClient::tr("Committed %n file(s).", 0, fileCount) + '\n'; if (fileCount) - return GitClient::tr("Amended \"%1\" (%n file(s)).", 0, fileCount).arg(amendSHA1) + QLatin1Char('\n'); + return GitClient::tr("Amended \"%1\" (%n file(s)).", 0, fileCount).arg(amendSHA1) + '\n'; return GitClient::tr("Amended \"%1\".").arg(amendSHA1); } @@ -2562,7 +2468,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory, const QString &messageFile, SubmitFileModel *model) { - const QString renameSeparator = QLatin1String(" -> "); + const QString renameSeparator = " -> "; QStringList filesToAdd; QStringList filesToRemove; @@ -2619,25 +2525,24 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory, return false; // Do the final commit - QStringList args; - args << QLatin1String("commit"); + QStringList arguments = { "commit" }; if (commitType == FixupCommit) { - args << QLatin1String("--fixup") << amendSHA1; + arguments << "--fixup" << amendSHA1; } else { - args << QLatin1String("-F") << QDir::toNativeSeparators(messageFile); + arguments << "-F" << QDir::toNativeSeparators(messageFile); if (commitType == AmendCommit) - args << QLatin1String("--amend"); + arguments << "--amend"; const QString &authorString = data.authorString(); if (!authorString.isEmpty()) - args << QLatin1String("--author") << authorString; + arguments << "--author" << authorString; if (data.bypassHooks) - args << QLatin1String("--no-verify"); + arguments << "--no-verify"; } QByteArray outputText; QByteArray errorText; - const bool rc = vcsFullySynchronousExec(repositoryDirectory, args, &outputText, &errorText); + const bool rc = vcsFullySynchronousExec(repositoryDirectory, arguments, &outputText, &errorText); const QString stdErr = commandOutputFromLocal8Bit(errorText); if (rc) { VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount)); @@ -2760,9 +2665,8 @@ void GitClient::revert(const QStringList &files, bool revertStaging) void GitClient::fetch(const QString &workingDirectory, const QString &remote) { - QStringList arguments(QLatin1String("fetch")); - arguments << (remote.isEmpty() ? QLatin1String("--all") : remote); - VcsCommand *command = vcsExec(workingDirectory, arguments, 0, true, + QStringList const arguments = { "fetch", (remote.isEmpty() ? QLatin1String("--all") : remote) }; + VcsCommand *command = vcsExec(workingDirectory, arguments, nullptr, true, VcsCommand::ShowSuccessMessage); connect(command, &VcsCommand::success, this, [workingDirectory]() { GitPlugin::instance()->updateBranches(workingDirectory); }); @@ -2786,12 +2690,12 @@ bool GitClient::executeAndHandleConflicts(const QString &workingDirectory, bool GitClient::synchronousPull(const QString &workingDirectory, bool rebase) { QString abortCommand; - QStringList arguments(QLatin1String("pull")); + QStringList arguments = { "pull" }; if (rebase) { - arguments << QLatin1String("--rebase"); - abortCommand = QLatin1String("rebase"); + arguments << "--rebase"; + abortCommand = "rebase"; } else { - abortCommand = QLatin1String("merge"); + abortCommand = "merge"; } bool ok = executeAndHandleConflicts(workingDirectory, arguments, abortCommand); @@ -2808,13 +2712,12 @@ void GitClient::synchronousAbortCommand(const QString &workingDir, const QString if (abortCommand.isEmpty()) { // no abort command - checkout index to clean working copy. synchronousCheckoutFiles(VcsManager::findTopLevelForDirectory(workingDir), - QStringList(), QString(), 0, false); + QStringList(), QString(), nullptr, false); return; } - QStringList arguments; - arguments << abortCommand << QLatin1String("--abort"); QByteArray stdOut; - vcsFullySynchronousExec(workingDir, arguments, &stdOut, 0, VcsCommand::ExpectRepoChanges); + vcsFullySynchronousExec(workingDir, { abortCommand, "--abort" }, &stdOut, nullptr, + VcsCommand::ExpectRepoChanges); VcsOutputWindow::append(commandOutputFromLocal8Bit(stdOut)); } @@ -2824,25 +2727,23 @@ QString GitClient::synchronousTrackingBranch(const QString &workingDirectory, co QString localBranch = branch.isEmpty() ? synchronousCurrentLocalBranch(workingDirectory) : branch; if (localBranch.isEmpty()) return QString(); - localBranch.prepend(QLatin1String("branch.")); - remote = readConfigValue(workingDirectory, localBranch + QLatin1String(".remote")); + localBranch.prepend("branch."); + remote = readConfigValue(workingDirectory, localBranch + ".remote"); if (remote.isEmpty()) return QString(); - const QString rBranch = readConfigValue(workingDirectory, localBranch + QLatin1String(".merge")) - .replace(QLatin1String("refs/heads/"), QString()); + const QString rBranch = readConfigValue(workingDirectory, localBranch + ".merge") + .replace("refs/heads/", QString()); if (rBranch.isEmpty()) return QString(); - return remote + QLatin1Char('/') + rBranch; + return remote + '/' + rBranch; } bool GitClient::synchronousSetTrackingBranch(const QString &workingDirectory, const QString &branch, const QString &tracking) { QByteArray outputText; - QStringList arguments; - arguments << QLatin1String("branch") - << (QLatin1String("--set-upstream-to=") + tracking) << branch; - return vcsFullySynchronousExec(workingDirectory, arguments, &outputText); + return vcsFullySynchronousExec( + workingDirectory, { "branch", "--set-upstream-to=" + tracking, branch }, &outputText); } void GitClient::handleMergeConflicts(const QString &workingDir, const QString &commit, @@ -2856,9 +2757,9 @@ void GitClient::handleMergeConflicts(const QString &workingDir, const QString &c QStringList partialFiles = files; while (partialFiles.count() > 20) partialFiles.removeLast(); - fileList = partialFiles.join(QLatin1Char('\n')); + fileList = partialFiles.join('\n'); if (partialFiles.count() != files.count()) - fileList += QLatin1String("\n..."); + fileList += "\n..."; message = tr("Conflicts detected with files:\n%1").arg(fileList); } else { message = tr("Conflicts detected."); @@ -2868,7 +2769,7 @@ void GitClient::handleMergeConflicts(const QString &workingDir, const QString &c QPushButton *mergeToolButton = mergeOrAbort.addButton(tr("Run &Merge Tool"), QMessageBox::AcceptRole); mergeOrAbort.addButton(QMessageBox::Ignore); - if (abortCommand == QLatin1String("rebase")) + if (abortCommand == "rebase") mergeOrAbort.addButton(tr("&Skip"), QMessageBox::RejectRole); if (!abortCommand.isEmpty()) mergeOrAbort.addButton(QMessageBox::Abort); @@ -2879,12 +2780,10 @@ void GitClient::handleMergeConflicts(const QString &workingDir, const QString &c case QMessageBox::Ignore: break; default: // Merge or Skip - if (mergeOrAbort.clickedButton() == mergeToolButton) { + if (mergeOrAbort.clickedButton() == mergeToolButton) merge(workingDir); - } else if (!abortCommand.isEmpty()) { - QStringList arguments = QStringList() << abortCommand << QLatin1String("--skip"); - executeAndHandleConflicts(workingDir, arguments, abortCommand); - } + else if (!abortCommand.isEmpty()) + executeAndHandleConflicts(workingDir, { abortCommand, "--skip" }, abortCommand); } } @@ -2896,22 +2795,19 @@ void GitClient::addFuture(const QFuture<void> &future) // Subversion: git svn void GitClient::synchronousSubversionFetch(const QString &workingDirectory) { - QStringList args; - args << QLatin1String("svn") << QLatin1String("fetch"); // Disable UNIX terminals to suppress SSH prompting. const unsigned flags = VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage; - vcsSynchronousExec(workingDirectory, args, flags); + vcsSynchronousExec(workingDirectory, { "svn", "fetch" }, flags); } void GitClient::subversionLog(const QString &workingDirectory) { - QStringList arguments; - arguments << QLatin1String("svn") << QLatin1String("log"); + QStringList arguments = { "svn", "log" }; int logCount = settings().intValue(GitSettings::logCountKey); if (logCount > 0) - arguments << (QLatin1String("--limit=") + QString::number(logCount)); + arguments << ("--limit=" + QString::number(logCount)); // Create a command editor, no highlighting or interaction. const QString title = tr("Git SVN Log"); @@ -2925,20 +2821,16 @@ void GitClient::subversionLog(const QString &workingDirectory) void GitClient::push(const QString &workingDirectory, const QStringList &pushArgs) { - QStringList arguments(QLatin1String("push")); - if (!pushArgs.isEmpty()) - arguments += pushArgs; - vcsExec(workingDirectory, arguments, 0, true); + vcsExec(workingDirectory, QStringList({ "push" }) + pushArgs, nullptr, true); } bool GitClient::synchronousMerge(const QString &workingDirectory, const QString &branch, bool allowFastForward) { - QString command = QLatin1String("merge"); - QStringList arguments(command); - + QString command = "merge"; + QStringList arguments = { command }; if (!allowFastForward) - arguments << QLatin1String("--no-ff"); + arguments << "--no-ff"; arguments << branch; return executeAndHandleConflicts(workingDirectory, arguments, command); } @@ -2946,8 +2838,8 @@ bool GitClient::synchronousMerge(const QString &workingDirectory, const QString bool GitClient::canRebase(const QString &workingDirectory) const { const QString gitDir = findGitDirForRepository(workingDirectory); - if (QFileInfo::exists(gitDir + QLatin1String("/rebase-apply")) - || QFileInfo::exists(gitDir + QLatin1String("/rebase-merge"))) { + if (QFileInfo::exists(gitDir + "/rebase-apply") + || QFileInfo::exists(gitDir + "/rebase-merge")) { VcsOutputWindow::appendError( tr("Rebase, merge or am is in progress. Finish " "or abort it and then try again.")); @@ -2958,19 +2850,18 @@ bool GitClient::canRebase(const QString &workingDirectory) const void GitClient::rebase(const QString &workingDirectory, const QString &argument) { - VcsCommand *command = vcsExecAbortable(workingDirectory, - QStringList() << QLatin1String("rebase") << argument); + VcsCommand *command = vcsExecAbortable(workingDirectory, { "rebase", argument }); GitProgressParser::attachToCommand(command); } void GitClient::cherryPick(const QString &workingDirectory, const QString &argument) { - vcsExecAbortable(workingDirectory, QStringList() << QLatin1String("cherry-pick") << argument); + vcsExecAbortable(workingDirectory, { "cherry-pick", argument }); } void GitClient::revert(const QString &workingDirectory, const QString &argument) { - vcsExecAbortable(workingDirectory, QStringList() << QLatin1String("revert") << argument); + vcsExecAbortable(workingDirectory, { "revert", argument }); } // Executes a command asynchronously. Work tree is expected to be clean. @@ -2978,11 +2869,11 @@ void GitClient::revert(const QString &workingDirectory, const QString &argument) VcsCommand *GitClient::vcsExecAbortable(const QString &workingDirectory, const QStringList &arguments) { - QTC_ASSERT(!arguments.isEmpty(), return 0); + QTC_ASSERT(!arguments.isEmpty(), return nullptr); QString abortCommand = arguments.at(0); // Git might request an editor, so this must be done asynchronously and without timeout - VcsCommand *command = createCommand(workingDirectory, 0, VcsWindowOutputBind); + VcsCommand *command = createCommand(workingDirectory, nullptr, VcsWindowOutputBind); command->setCookie(workingDirectory); command->addFlags(VcsCommand::ShowSuccessMessage); command->addJob(vcsBinary(), arguments, 0); @@ -2994,28 +2885,24 @@ VcsCommand *GitClient::vcsExecAbortable(const QString &workingDirectory, bool GitClient::synchronousRevert(const QString &workingDirectory, const QString &commit) { - QStringList arguments; - const QString command = QLatin1String("revert"); + const QString command = "revert"; // Do not stash if --continue or --abort is given as the commit - if (!commit.startsWith(QLatin1Char('-')) && !beginStashScope(workingDirectory, command)) + if (!commit.startsWith('-') && !beginStashScope(workingDirectory, command)) return false; - - arguments << command << QLatin1String("--no-edit") << commit; - - return executeAndHandleConflicts(workingDirectory, arguments, command); + return executeAndHandleConflicts(workingDirectory, { command, "--no-edit", commit }, command); } bool GitClient::synchronousCherryPick(const QString &workingDirectory, const QString &commit) { - const QString command = QLatin1String("cherry-pick"); + const QString command = "cherry-pick"; // "commit" might be --continue or --abort - const bool isRealCommit = !commit.startsWith(QLatin1Char('-')); + const bool isRealCommit = !commit.startsWith('-'); if (isRealCommit && !beginStashScope(workingDirectory, command)) return false; - QStringList arguments(command); + QStringList arguments = { command }; if (isRealCommit && isRemoteCommit(workingDirectory, commit)) - arguments << QLatin1String("-x"); + arguments << "-x"; arguments << commit; return executeAndHandleConflicts(workingDirectory, arguments, command); @@ -3023,11 +2910,10 @@ bool GitClient::synchronousCherryPick(const QString &workingDirectory, const QSt void GitClient::interactiveRebase(const QString &workingDirectory, const QString &commit, bool fixup) { - QStringList arguments; - arguments << QLatin1String("rebase") << QLatin1String("-i"); + QStringList arguments = { "rebase", "-i" }; if (fixup) - arguments << QLatin1String("--autosquash"); - arguments << commit + QLatin1Char('^'); + arguments << "--autosquash"; + arguments << commit + '^'; if (fixup) m_disableEditor = true; VcsCommand *command = vcsExecAbortable(workingDirectory, arguments); @@ -3048,11 +2934,10 @@ QString GitClient::msgNoCommits(bool includeRemote) void GitClient::stashPop(const QString &workingDirectory, const QString &stash) { - QStringList arguments(QLatin1String("stash")); - arguments << QLatin1String("pop"); + QStringList arguments = { "stash", "pop" }; if (!stash.isEmpty()) arguments << stash; - VcsCommand *cmd = vcsExec(workingDirectory, arguments, 0, true, VcsCommand::ExpectRepoChanges); + VcsCommand *cmd = vcsExec(workingDirectory, arguments, nullptr, true, VcsCommand::ExpectRepoChanges); ConflictHandler::attachToCommand(cmd); } @@ -3061,23 +2946,22 @@ bool GitClient::synchronousStashRestore(const QString &workingDirectory, bool pop, const QString &branch /* = QString()*/) const { - QStringList arguments(QLatin1String("stash")); + QStringList arguments = { "stash" }; if (branch.isEmpty()) arguments << QLatin1String(pop ? "pop" : "apply") << stash; else - arguments << QLatin1String("branch") << branch << stash; + arguments << "branch" << branch << stash; return executeAndHandleConflicts(workingDirectory, arguments); } -bool GitClient::synchronousStashRemove(const QString &workingDirectory, - const QString &stash /* = QString() */, - QString *errorMessage /* = 0 */) const +bool GitClient::synchronousStashRemove(const QString &workingDirectory, const QString &stash, + QString *errorMessage) const { - QStringList arguments(QLatin1String("stash")); + QStringList arguments = { "stash" }; if (stash.isEmpty()) - arguments << QLatin1String("clear"); + arguments << "clear"; else - arguments << QLatin1String("drop") << stash; + arguments << "drop" << stash; QByteArray outputText; QByteArray errorText; const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText); @@ -3091,15 +2975,13 @@ bool GitClient::synchronousStashRemove(const QString &workingDirectory, return rc; } -bool GitClient::synchronousStashList(const QString &workingDirectory, - QList<Stash> *stashes, - QString *errorMessage /* = 0 */) const +bool GitClient::synchronousStashList(const QString &workingDirectory, QList<Stash> *stashes, + QString *errorMessage) const { stashes->clear(); - QStringList arguments(QLatin1String("stash")); - arguments << QLatin1String("list") << QLatin1String(noColorOption); QByteArray outputText; QByteArray errorText; + const QStringList arguments = { "stash", "list", noColorOption }; const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText); if (!rc) { msgCannotRun(arguments, workingDirectory, errorText, errorMessage); @@ -3115,16 +2997,12 @@ bool GitClient::synchronousStashList(const QString &workingDirectory, // Read a single-line config value, return trimmed QString GitClient::readConfigValue(const QString &workingDirectory, const QString &configVar) const { - QStringList arguments; - arguments << QLatin1String("config") << configVar; - return readOneLine(workingDirectory, arguments); + return readOneLine(workingDirectory, { "config", configVar }); } QString GitClient::readGitVar(const QString &workingDirectory, const QString &configVar) const { - QStringList arguments; - arguments << QLatin1String("var") << configVar; - return readOneLine(workingDirectory, arguments); + return readOneLine(workingDirectory, { "var", configVar }); } QString GitClient::readOneLine(const QString &workingDirectory, const QStringList &arguments) const @@ -3154,39 +3032,32 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url) if (!synchronousInit(workingDirectory.path())) return false; - QStringList arguments(QLatin1String("remote")); - arguments << QLatin1String("add") << QLatin1String("origin") << QLatin1String(url); - if (!vcsFullySynchronousExec(workingDirectory.path(), arguments, 0)) + if (!vcsFullySynchronousExec(workingDirectory.path(), + { "remote", "add", "origin", QString::fromUtf8(url) }, nullptr)) { return false; + } - arguments.clear(); - arguments << QLatin1String("fetch"); const SynchronousProcessResponse resp - = vcsSynchronousExec(workingDirectory.path(), arguments, flags); + = vcsSynchronousExec(workingDirectory.path(), { "fetch" }, flags); if (resp.result != SynchronousProcessResponse::Finished) return false; - arguments.clear(); - arguments << QLatin1String("config") - << QLatin1String("branch.master.remote") - << QLatin1String("origin"); - if (!vcsFullySynchronousExec(workingDirectory.path(), arguments, 0)) + if (!vcsFullySynchronousExec(workingDirectory.path(), + { "config", "branch.master.remote", "origin" }, nullptr)) { return false; + } - arguments.clear(); - arguments << QLatin1String("config") - << QLatin1String("branch.master.merge") - << QLatin1String("refs/heads/master"); - if (!vcsFullySynchronousExec(workingDirectory.path(), arguments, 0)) + if (!vcsFullySynchronousExec(workingDirectory.path(), + { "config", "branch.master.merge", "refs/heads/master" }, nullptr)) { return false; + } return true; } else { - QStringList arguments(QLatin1String("clone")); - arguments << QLatin1String(url) << workingDirectory.dirName(); workingDirectory.cdUp(); - const SynchronousProcessResponse resp - = vcsSynchronousExec(workingDirectory.path(), arguments, flags); + const SynchronousProcessResponse resp = vcsSynchronousExec( + workingDirectory.path(), + { "clone", QString::fromUtf8(url), workingDirectory.dirName() }, flags); resetCachedVcsInfo(workingDirectory.absolutePath()); return (resp.result == SynchronousProcessResponse::Finished); } @@ -3214,7 +3085,7 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const // run git --version QByteArray outputText; QByteArray errorText; - const bool rc = vcsFullySynchronousExec(QString(), QStringList(QLatin1String("--version")), + const bool rc = vcsFullySynchronousExec(QString(), { "--version" }, &outputText, &errorText, silentFlags); if (!rc) { msgCannotRun(tr("Cannot determine Git version: %1") @@ -3225,7 +3096,7 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const // cut 'git version 1.6.5.1.sha' // another form: 'git version 1.9.rc1' const QString output = commandOutputFromLocal8Bit(outputText); - QRegExp versionPattern(QLatin1String("^[^\\d]+(\\d+)\\.(\\d+)\\.(\\d+|rc\\d).*$")); + QRegExp versionPattern("^[^\\d]+(\\d+)\\.(\\d+)\\.(\\d+|rc\\d).*$"); QTC_ASSERT(versionPattern.isValid(), return 0); QTC_ASSERT(versionPattern.exactMatch(output), return 0); const unsigned majorV = versionPattern.cap(1).toUInt(0, 16); @@ -3267,9 +3138,8 @@ void GitClient::StashInfo::stashPrompt(const QString &command, const QString &st QString *errorMessage) { QMessageBox msgBox(QMessageBox::Question, tr("Uncommitted Changes Found"), - tr("What would you like to do with local changes in:") - + QLatin1String("\n\n\"") - + QDir::toNativeSeparators(m_workingDir) + QLatin1Char('\"'), + tr("What would you like to do with local changes in:") + "\n\n" + + QDir::toNativeSeparators(m_workingDir) + '\"', QMessageBox::NoButton, ICore::mainWindow()); msgBox.setDetailedText(statusOutput); @@ -3283,7 +3153,7 @@ void GitClient::StashInfo::stashPrompt(const QString &command, const QString &st QPushButton *discardButton = msgBox.addButton(tr("Discard"), QMessageBox::AcceptRole); discardButton->setToolTip(tr("Discard (reset) local changes and execute %1.").arg(command)); - QPushButton *ignoreButton = 0; + QPushButton *ignoreButton = nullptr; if (m_flags & AllowUnstashed) { ignoreButton = msgBox.addButton(QMessageBox::Ignore); ignoreButton->setToolTip(tr("Execute %1 with local changes in working directory.") diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index df12bc74523..250ce4c220f 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -126,7 +126,7 @@ public: explicit GitClient(); Utils::FileName vcsBinary() const override; - unsigned gitVersion(QString *errorMessage = 0) const; + unsigned gitVersion(QString *errorMessage = nullptr) const; VcsBase::VcsCommand *vcsExecAbortable(const QString &workingDirectory, const QStringList &arguments); @@ -154,10 +154,8 @@ public: int lineNumber = -1, const QStringList &extraOptions = QStringList()) override; void reset(const QString &workingDirectory, const QString &argument, const QString &commit = QString()); void addFile(const QString &workingDirectory, const QString &fileName); - bool synchronousLog(const QString &workingDirectory, - const QStringList &arguments, - QString *output, - QString *errorMessage = 0, + bool synchronousLog(const QString &workingDirectory, const QStringList &arguments, + QString *output, QString *errorMessage = nullptr, unsigned flags = 0); bool synchronousAdd(const QString &workingDirectory, const QStringList &files); bool synchronousDelete(const QString &workingDirectory, @@ -166,20 +164,20 @@ public: bool synchronousMove(const QString &workingDirectory, const QString &from, const QString &to); - bool synchronousReset(const QString &workingDirectory, - const QStringList &files = QStringList(), - QString *errorMessage = 0); - bool synchronousCleanList(const QString &workingDirectory, const QString &modulePath, QStringList *files, QStringList *ignoredFiles, QString *errorMessage); - bool synchronousApplyPatch(const QString &workingDirectory, const QString &file, QString *errorMessage, const QStringList &arguments = QStringList()); + bool synchronousReset(const QString &workingDirectory, const QStringList &files = QStringList(), + QString *errorMessage = nullptr); + bool synchronousCleanList(const QString &workingDirectory, const QString &modulePath, + QStringList *files, QStringList *ignoredFiles, QString *errorMessage); + bool synchronousApplyPatch(const QString &workingDirectory, const QString &file, + QString *errorMessage, const QStringList &extraArguments = QStringList()); bool synchronousInit(const QString &workingDirectory); - bool synchronousCheckoutFiles(const QString &workingDirectory, - QStringList files = QStringList(), - QString revision = QString(), QString *errorMessage = 0, + bool synchronousCheckoutFiles(const QString &workingDirectory, QStringList files = QStringList(), + QString revision = QString(), QString *errorMessage = nullptr, bool revertStaging = true); // Checkout ref bool stashAndCheckout(const QString &workingDirectory, const QString &ref); bool synchronousCheckout(const QString &workingDirectory, const QString &ref, - QString *errorMessage = 0); + QString *errorMessage = nullptr); QStringList setupCheckoutArguments(const QString &workingDirectory, const QString &ref); void updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt); @@ -188,39 +186,40 @@ public: enum { StashPromptDescription = 0x1, StashImmediateRestore = 0x2, StashIgnoreUnchanged = 0x4 }; QString synchronousStash(const QString &workingDirectory, const QString &messageKeyword = QString(), - unsigned flags = 0, bool *unchanged = 0) const; + unsigned flags = 0, bool *unchanged = nullptr) const; bool executeSynchronousStash(const QString &workingDirectory, const QString &message = QString(), bool unstagedOnly = false, - QString *errorMessage = 0) const; + QString *errorMessage = nullptr) const; bool synchronousStashRestore(const QString &workingDirectory, const QString &stash, bool pop = false, const QString &branch = QString()) const; bool synchronousStashRemove(const QString &workingDirectory, const QString &stash = QString(), - QString *errorMessage = 0) const; + QString *errorMessage = nullptr) const; bool synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs, QString *output, QString *errorMessage) const; bool synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs, QString *output, QString *errorMessage) const; bool synchronousForEachRefCmd(const QString &workingDirectory, QStringList args, - QString *output, QString *errorMessage = 0) const; + QString *output, QString *errorMessage = nullptr) const; VcsBase::VcsCommand *asyncForEachRefCmd(const QString &workingDirectory, QStringList args) const; bool synchronousRemoteCmd(const QString &workingDirectory, QStringList remoteArgs, - QString *output = 0, QString *errorMessage = 0, bool silent = false) const; + QString *output = nullptr, QString *errorMessage = nullptr, + bool silent = false) const; QMap<QString,QString> synchronousRemotesList(const QString &workingDirectory, - QString *errorMessage = 0) const; + QString *errorMessage = nullptr) const; QStringList synchronousSubmoduleStatus(const QString &workingDirectory, - QString *errorMessage = 0) const; + QString *errorMessage = nullptr) const; SubmoduleDataMap submoduleList(const QString &workingDirectory) const; bool synchronousShow(const QString &workingDirectory, const QString &id, QByteArray *output, QString *errorMessage) const; - bool synchronousRevListCmd(const QString &workingDirectory, const QStringList &arguments, - QString *output, QString *errorMessage = 0) const; + bool synchronousRevListCmd(const QString &workingDirectory, const QStringList &extraArguments, + QString *output, QString *errorMessage = nullptr) const; bool synchronousParentRevisions(const QString &workingDirectory, const QString &revision, @@ -233,11 +232,11 @@ public: QString synchronousCurrentLocalBranch(const QString &workingDirectory) const; bool synchronousHeadRefs(const QString &workingDirectory, QStringList *output, - QString *errorMessage = 0) const; + QString *errorMessage = nullptr) const; QString synchronousTopic(const QString &workingDirectory) const; bool synchronousRevParseCmd(const QString &workingDirectory, const QString &ref, - QString *output, QString *errorMessage = 0) const; - QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = 0); + QString *output, QString *errorMessage = nullptr) const; + QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = nullptr); void synchronousTagsForCommit(const QString &workingDirectory, const QString &revision, QString &precedes, QString &follows) const; bool isRemoteCommit(const QString &workingDirectory, const QString &commit); @@ -270,21 +269,19 @@ public: void stashPop(const QString &workingDirectory, const QString &stash = QString()); void revert(const QStringList &files, bool revertStaging); - bool synchronousStashList(const QString &workingDirectory, - QList<Stash> *stashes, - QString *errorMessage = 0) const; + bool synchronousStashList(const QString &workingDirectory, QList<Stash> *stashes, + QString *errorMessage = nullptr) const; // Resolve a stash name from message (for IVersionControl's names). - bool stashNameFromMessage(const QString &workingDirectory, - const QString &messge, QString *name, - QString *errorMessage = 0) const; + bool stashNameFromMessage(const QString &workingDirectory, const QString &messge, QString *name, + QString *errorMessage = nullptr) const; QString readGitVar(const QString &workingDirectory, const QString &configVar) const; QString readConfigValue(const QString &workingDirectory, const QString &configVar) const; QTextCodec *encoding(const QString &workingDirectory, const QByteArray &configVar) const; bool readDataFromCommit(const QString &repoDirectory, const QString &commit, - CommitData &commitData, QString *errorMessage = 0, - QString *commitTemplate = 0); + CommitData &commitData, QString *errorMessage = nullptr, + QString *commitTemplate = nullptr); bool getCommitData(const QString &workingDirectory, QString *commitTemplate, CommitData &commitData, QString *errorMessage); @@ -296,10 +293,8 @@ public: VcsBase::SubmitFileModel *model); enum StatusResult { StatusChanged, StatusUnchanged, StatusFailed }; - StatusResult gitStatus(const QString &workingDirectory, - StatusMode mode, - QString *output = 0, - QString *errorMessage = 0) const; + StatusResult gitStatus(const QString &workingDirectory, StatusMode mode, + QString *output = nullptr, QString *errorMessage = nullptr) const; CommandInProgress checkCommandInProgress(const QString &workingDirectory) const; QString commandInProgressDescription(const QString &workingDirectory) const; @@ -350,7 +345,7 @@ private: std::function<DiffEditor::DiffEditorController *(Core::IDocument *)> factory) const; // determine version as '(major << 16) + (minor << 8) + patch' or 0. - unsigned synchronousGitVersion(QString *errorMessage = 0) const; + unsigned synchronousGitVersion(QString *errorMessage = nullptr) const; QString readOneLine(const QString &workingDirectory, const QStringList &arguments) const; diff --git a/src/plugins/modeleditor/actionhandler.cpp b/src/plugins/modeleditor/actionhandler.cpp index 8f0d31a9833..eeec74e89a7 100644 --- a/src/plugins/modeleditor/actionhandler.cpp +++ b/src/plugins/modeleditor/actionhandler.cpp @@ -199,10 +199,10 @@ void ActionHandler::createActions() Constants::OPEN_PARENT_DIAGRAM, [this]() { openParentDiagram(); }, Core::Context(), true, tr("Open Parent Diagram"), QKeySequence(QStringLiteral("Ctrl+Shift+P")))->action(); d->openParentDiagramAction->setIcon(QIcon(QStringLiteral(":/modeleditor/up.png"))); - registerCommand(Constants::ACTION_ADD_PACKAGE, nullptr, Core::Context()); - registerCommand(Constants::ACTION_ADD_COMPONENT, nullptr, Core::Context()); - registerCommand(Constants::ACTION_ADD_CLASS, nullptr, Core::Context()); - registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr, Core::Context()); + registerCommand(Constants::ACTION_ADD_PACKAGE, nullptr, Core::Context(), true, tr("Add Package")); + registerCommand(Constants::ACTION_ADD_COMPONENT, nullptr, Core::Context(), true, tr("Add Component")); + registerCommand(Constants::ACTION_ADD_CLASS, nullptr, Core::Context(), true, tr("Add Class")); + registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr, Core::Context(), true, tr("Add Canvas Diagram")); d->synchronizeBrowserAction = registerCommand( Constants::ACTION_SYNC_BROWSER, nullptr, Core::Context(), true, tr("Synchronize Browser and Diagram<br><i><small>Press&Hold for options</small></i>"))->action(); diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 59c97c0efd5..955f2279634 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -321,8 +321,7 @@ QWidget *AppOutputPane::outputWidget(QWidget *) QList<QWidget*> AppOutputPane::toolBarWidgets() const { - return QList<QWidget*>() << m_reRunButton << m_stopButton << m_attachButton - << m_zoomInButton << m_zoomOutButton; + return { m_reRunButton, m_stopButton, m_attachButton, m_zoomInButton, m_zoomOutButton }; } QString AppOutputPane::displayName() const diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index ed406f17ba6..61917bfdaf2 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -244,9 +244,7 @@ QWidget *CompileOutputWindow::outputWidget(QWidget *) QList<QWidget *> CompileOutputWindow::toolBarWidgets() const { - return QList<QWidget *>() << m_cancelBuildButton - << m_zoomInButton - << m_zoomOutButton; + return { m_cancelBuildButton, m_zoomInButton, m_zoomOutButton }; } void CompileOutputWindow::appendText(const QString &text, BuildStep::OutputFormat format) diff --git a/src/plugins/projectexplorer/customtoolchain.cpp b/src/plugins/projectexplorer/customtoolchain.cpp index a910450113d..e14562ca1b6 100644 --- a/src/plugins/projectexplorer/customtoolchain.cpp +++ b/src/plugins/projectexplorer/customtoolchain.cpp @@ -164,7 +164,10 @@ const QStringList &CustomToolChain::rawPredefinedMacros() const void CustomToolChain::setPredefinedMacros(const QStringList &list) { + if (m_predefinedMacros == list) + return; m_predefinedMacros = list; + toolChainUpdated(); } QList<HeaderPath> CustomToolChain::systemHeaderPaths(const QStringList &cxxFlags, const FileName &) const @@ -215,9 +218,14 @@ QStringList CustomToolChain::headerPathsList() const void CustomToolChain::setHeaderPaths(const QStringList &list) { - m_systemHeaderPaths = Utils::transform(list, [](const QString &headerPath) { + QList<HeaderPath> tmp = Utils::transform(list, [](const QString &headerPath) { return HeaderPath(headerPath.trimmed(), HeaderPath::GlobalHeaderPath); }); + + if (m_systemHeaderPaths == tmp) + return; + m_systemHeaderPaths = tmp; + toolChainUpdated(); } void CustomToolChain::setCompilerCommand(const FileName &path) @@ -261,8 +269,14 @@ const QStringList &CustomToolChain::cxx11Flags() const void CustomToolChain::setMkspecs(const QString &specs) { - m_mkspecs = Utils::transform(specs.split(QLatin1Char(',')), - [](QString fn) { return FileName::fromString(fn); }); + Utils::FileNameList tmp + = Utils::transform(specs.split(QLatin1Char(',')), + [](QString fn) { return FileName::fromString(fn); }); + + if (tmp == m_mkspecs) + return; + m_mkspecs = tmp; + toolChainUpdated(); } QString CustomToolChain::mkspecs() const @@ -367,7 +381,10 @@ CustomToolChain::OutputParser CustomToolChain::outputParserType() const void CustomToolChain::setOutputParserType(CustomToolChain::OutputParser parser) { + if (m_outputParser == parser) + return; m_outputParser = parser; + toolChainUpdated(); } CustomParserSettings CustomToolChain::customParserSettings() const @@ -377,7 +394,10 @@ CustomParserSettings CustomToolChain::customParserSettings() const void CustomToolChain::setCustomParserSettings(const CustomParserSettings &settings) { + if (m_customParserSettings == settings) + return; m_customParserSettings = settings; + toolChainUpdated(); } QString CustomToolChain::parserName(CustomToolChain::OutputParser parser) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index dd055755aee..cc328d57af1 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -230,16 +230,25 @@ void GccToolChain::setCompilerCommand(const FileName &path) return; m_compilerCommand = path; + toolChainUpdated(); } void GccToolChain::setSupportedAbis(const QList<Abi> &m_abis) { + if (m_supportedAbis == m_abis) + return; + m_supportedAbis = m_abis; + toolChainUpdated(); } void GccToolChain::setOriginalTargetTriple(const QString &targetTriple) { + if (m_originalTargetTriple == targetTriple) + return; + m_originalTargetTriple = targetTriple; + toolChainUpdated(); } void GccToolChain::setMacroCache(const QStringList &allCxxflags, const QByteArray ¯os) const diff --git a/src/plugins/projectexplorer/kitmodel.cpp b/src/plugins/projectexplorer/kitmodel.cpp index 2a63f20c681..d543022c51a 100644 --- a/src/plugins/projectexplorer/kitmodel.cpp +++ b/src/plugins/projectexplorer/kitmodel.cpp @@ -345,7 +345,7 @@ void KitModel::removeKit(Kit *k) if (node == m_defaultNode) setDefaultNode(findSecondLevelItem([node](KitNode *kn) { return kn != node; })); - delete takeItem(node); + destroyItem(node); validateKitNames(); emit kitStateChanged(); diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 08d7c205595..eb35908f4d7 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -259,8 +259,6 @@ QByteArray MsvcToolChain::msvcPredefinedMacros(const QStringList cxxflags, QStringList split = line.split('='); const QString key = split.at(0).mid(1); QString value = split.at(1); - if (!value.isEmpty()) - value.chop(1); //remove '\n' predefinedMacros += "#define "; predefinedMacros += key.toUtf8(); predefinedMacros += ' '; diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 9225d4d182c..beb8b58bdce 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -348,7 +348,7 @@ void TaskWindow::delayedInitialization() QList<QWidget*> TaskWindow::toolBarWidgets() const { - return QList<QWidget*>() << d->m_filterWarningsButton << d->m_categoriesButton; + return { d->m_filterWarningsButton, d->m_categoriesButton }; } QWidget *TaskWindow::outputWidget(QWidget *) diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp index ee40edfbb0e..190d2f52b44 100644 --- a/src/plugins/projectexplorer/toolchainoptionspage.cpp +++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp @@ -236,7 +236,7 @@ void ToolChainOptionsWidget::addToolChain(ToolChain *tc) } } - TreeItem *parent = m_model.rootItem()->child(tc->isAutoDetected() ? 0 : 1); + TreeItem *parent = m_model.rootItem()->childAt(tc->isAutoDetected() ? 0 : 1); parent->appendChild(new ToolChainTreeItem(tc, false)); updateState(); @@ -255,7 +255,7 @@ void ToolChainOptionsWidget::removeToolChain(ToolChain *tc) auto item = m_model.findSecondLevelItem([tc](ToolChainTreeItem *item) { return tc->isAutoDetected() && item->toolChain == tc; }); - delete m_model.takeItem(item); + m_model.destroyItem(item); updateState(); } diff --git a/src/plugins/qmldesigner/components/stateseditor/stateeditorsiconprovider.cpp b/src/plugins/qmldesigner/components/stateseditor/stateeditorsiconprovider.cpp new file mode 100644 index 00000000000..c57462409ce --- /dev/null +++ b/src/plugins/qmldesigner/components/stateseditor/stateeditorsiconprovider.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "stateseditoriconprovider.h" + +#include <coreplugin/coreicons.h> + +namespace QmlDesigner { + +StatesEditorIconProvider::StatesEditorIconProvider() + : QQuickImageProvider(Pixmap) +{ + +} + +QPixmap StatesEditorIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) +{ + Q_UNUSED(requestedSize) + + QPixmap result; + + if (id == "close") + result = Core::Icons::CLOSE_TOOLBAR.pixmap(); + + else if (id == "plus") + result = Core::Icons::PLUS.pixmap(); + + if (size) + *size = result.size(); + return result; +} + +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditor.pri b/src/plugins/qmldesigner/components/stateseditor/stateseditor.pri index 3054479edba..82308af935c 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditor.pri +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditor.pri @@ -5,8 +5,10 @@ VPATH += $$PWD SOURCES += stateseditorwidget.cpp \ stateseditormodel.cpp \ stateseditorview.cpp \ - stateseditorimageprovider.cpp + stateseditorimageprovider.cpp \ + stateeditorsiconprovider.cpp HEADERS += stateseditorwidget.h \ stateseditormodel.h \ stateseditorview.h \ - stateseditorimageprovider.cpp + stateseditorimageprovider.h \ + stateseditoriconprovider.h diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditoriconprovider.h b/src/plugins/qmldesigner/components/stateseditor/stateseditoriconprovider.h new file mode 100644 index 00000000000..94fddeef0b9 --- /dev/null +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditoriconprovider.h @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include <QQuickImageProvider> + +namespace QmlDesigner { + +class StatesEditorIconProvider : public QQuickImageProvider +{ +public: + StatesEditorIconProvider(); + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override; +}; + +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp index 52b4620d9fe..35567e22a16 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp @@ -27,10 +27,12 @@ #include "stateseditormodel.h" #include "stateseditorview.h" #include "stateseditorimageprovider.h" +#include "stateseditoriconprovider.h" #include <invalidqmlsourceexception.h> #include <coreplugin/icore.h> + #include <utils/qtcassert.h> #include <utils/stylehelper.h> @@ -95,9 +97,10 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State rootContext()->setContextProperty(QStringLiteral("statesEditorModel"), statesEditorModel); rootContext()->setContextProperty(QStringLiteral("highlightColor"), Utils::StyleHelper::notTooBrightHighlightColor()); - rootContext()->setContextProperty(QLatin1String("canAddNewStates"), true); + engine()->addImageProvider(QLatin1String("icons"), new StatesEditorIconProvider()); + setWindowTitle(tr("States", "Title of Editor widget")); // init the first load of the QML UI elements diff --git a/src/plugins/qmldesigner/componentsplugin/componentsplugin.qbs b/src/plugins/qmldesigner/componentsplugin/componentsplugin.qbs index 74fd8b8991a..55f6c6a1df5 100644 --- a/src/plugins/qmldesigner/componentsplugin/componentsplugin.qbs +++ b/src/plugins/qmldesigner/componentsplugin/componentsplugin.qbs @@ -28,6 +28,7 @@ QtcProduct { "../../../../share/qtcreator/qml/qmlpuppet/interfaces", "../../../../share/qtcreator/qml/qmlpuppet/types", ]) + cpp.internalVersion: "" Group { name: "controls" diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 985112938f2..6fcd6b52a6c 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -554,6 +554,9 @@ Project { "propertyeditor/qmlmodelnodeproxy.h", "resources/resources.qrc", "stateseditor/stateseditorimageprovider.cpp", + "stateseditor/stateseditorimageprovider.h", + "stateseditor/stateeditorsiconprovider.cpp", + "stateseditor/stateseditoriconprovider.h", "stateseditor/stateseditormodel.cpp", "stateseditor/stateseditormodel.h", "stateseditor/stateseditorview.cpp", diff --git a/src/plugins/qmldesigner/qtquickplugin/qtquickplugin.qbs b/src/plugins/qmldesigner/qtquickplugin/qtquickplugin.qbs index 18540ee72d9..60f07116742 100644 --- a/src/plugins/qmldesigner/qtquickplugin/qtquickplugin.qbs +++ b/src/plugins/qmldesigner/qtquickplugin/qtquickplugin.qbs @@ -8,6 +8,7 @@ QtcProduct { cpp.defines: base.concat("QTQUICK_LIBRARY") cpp.includePaths: base.concat("../designercore/include") + cpp.internalVersion: "" Group { name: "sources" diff --git a/src/plugins/qmljstools/images/collapse.png b/src/plugins/qmljstools/images/collapse.png Binary files differdeleted file mode 100644 index 64ae3720c11..00000000000 --- a/src/plugins/qmljstools/images/collapse.png +++ /dev/null diff --git a/src/plugins/qmljstools/images/expand.png b/src/plugins/qmljstools/images/expand.png Binary files differdeleted file mode 100644 index 7959bfc97ef..00000000000 --- a/src/plugins/qmljstools/images/expand.png +++ /dev/null diff --git a/src/plugins/qmljstools/qmljstools.qrc b/src/plugins/qmljstools/qmljstools.qrc index 45c345ece6f..a7f44837497 100644 --- a/src/plugins/qmljstools/qmljstools.qrc +++ b/src/plugins/qmljstools/qmljstools.qrc @@ -2,8 +2,6 @@ <qresource prefix="/qmljstools"> <file>images/category_qml.png</file> <file>images/prompt.png</file> - <file>images/collapse.png</file> - <file>images/expand.png</file> <file>QmlJSTools.mimetypes.xml</file> </qresource> </RCC> diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.cpp b/src/plugins/qmlprofiler/pixmapcachemodel.cpp index d497c1996a6..e21fcca8231 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.cpp +++ b/src/plugins/qmlprofiler/pixmapcachemodel.cpp @@ -349,9 +349,10 @@ void PixmapCacheModel::loadEvent(const QmlEvent &event, const QmlEventType &type } } } + } else { + insertEnd(state.started, pixmapStartTime - startTime(state.started)); } - insertEnd(state.started, pixmapStartTime - startTime(state.started)); if (pixmapType == PixmapLoadingError) { state.loadState = Error; switch (state.cacheState) { diff --git a/src/plugins/qmlprofiler/qmlnote.cpp b/src/plugins/qmlprofiler/qmlnote.cpp index 30509cb961a..9752ef209a4 100644 --- a/src/plugins/qmlprofiler/qmlnote.cpp +++ b/src/plugins/qmlprofiler/qmlnote.cpp @@ -30,18 +30,21 @@ namespace QmlProfiler { QDataStream &operator>>(QDataStream &stream, QmlNote ¬e) { - return stream >> note.m_typeIndex >> note.m_startTime >> note.m_duration >> note.m_text; + return stream >> note.m_typeIndex >> note.m_collapsedRow >> note.m_startTime >> note.m_duration + >> note.m_text; } QDataStream &operator<<(QDataStream &stream, const QmlNote ¬e) { - return stream << note.m_typeIndex << note.m_startTime << note.m_duration << note.m_text; + return stream << note.m_typeIndex << note.m_collapsedRow << note.m_startTime << note.m_duration + << note.m_text; } bool operator==(const QmlNote ¬e1, const QmlNote ¬e2) { - return note1.typeIndex() == note2.typeIndex() && note1.startTime() == note2.startTime() - && note1.duration() == note2.duration() && note1.text() == note2.text(); + return note1.typeIndex() == note2.typeIndex() && note1.collapsedRow() == note2.collapsedRow() + && note1.startTime() == note2.startTime() && note1.duration() == note2.duration() + && note1.text() == note2.text(); } bool operator!=(const QmlNote ¬e1, const QmlNote ¬e2) diff --git a/src/plugins/qmlprofiler/qmlnote.h b/src/plugins/qmlprofiler/qmlnote.h index 20dac22d098..d57af60bed5 100644 --- a/src/plugins/qmlprofiler/qmlnote.h +++ b/src/plugins/qmlprofiler/qmlnote.h @@ -32,26 +32,32 @@ namespace QmlProfiler { class QmlNote { public: - QmlNote(int typeIndex = -1, qint64 startTime = -1, qint64 duration = 0, + QmlNote(int typeIndex = -1, int collapsedRow = -1, qint64 startTime = -1, qint64 duration = 0, const QString &text = QString()) : - m_typeIndex(typeIndex), m_startTime(startTime), m_duration(duration), m_text(text) + m_typeIndex(typeIndex), m_collapsedRow(collapsedRow), m_startTime(startTime), + m_duration(duration), m_text(text), m_loaded(false) {} int typeIndex() const { return m_typeIndex; } + int collapsedRow() const { return m_collapsedRow; } qint64 startTime() const { return m_startTime; } qint64 duration() const { return m_duration; } QString text() const { return m_text; } + bool loaded() const { return m_loaded; } void setText(const QString &text) { m_text = text; } + void setLoaded(bool loaded) { m_loaded = loaded; } private: friend QDataStream &operator>>(QDataStream &stream, QmlNote ¬e); friend QDataStream &operator<<(QDataStream &stream, const QmlNote ¬e); int m_typeIndex; + int m_collapsedRow; qint64 m_startTime; qint64 m_duration; QString m_text; + bool m_loaded; }; bool operator==(const QmlNote ¬e1, const QmlNote ¬e2); diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index 067af444b4d..e19df2893ea 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -443,6 +443,9 @@ void QmlProfilerModelManager::clear() void QmlProfilerModelManager::restrictToRange(qint64 startTime, qint64 endTime) { d->notesModel->saveData(); + const QVector<QmlNote> notes = d->notesModel->notes(); + d->notesModel->clear(); + setState(ClearingData); setVisibleFeatures(0); @@ -450,7 +453,7 @@ void QmlProfilerModelManager::restrictToRange(qint64 startTime, qint64 endTime) d->model->replayEvents(startTime, endTime, std::bind(&QmlProfilerModelManager::dispatch, this, std::placeholders::_1, std::placeholders::_2)); - d->notesModel->loadData(); + d->notesModel->setNotes(notes); d->traceTime->restrictToRange(startTime, endTime); acquiringDone(); } diff --git a/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp b/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp index e67f6bd3724..b59a942ffbb 100644 --- a/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp @@ -26,15 +26,19 @@ #include "qmlprofilernotesmodel.h" #include "qmlprofilerdatamodel.h" +#include <utils/algorithm.h> + namespace QmlProfiler { QmlProfilerNotesModel::QmlProfilerNotesModel(QObject *parent) : TimelineNotesModel(parent) { } -int QmlProfilerNotesModel::addQmlNote(int typeId, qint64 start, qint64 duration, +int QmlProfilerNotesModel::addQmlNote(int typeId, int collapsedRow, qint64 start, qint64 duration, const QString &text) { + qint64 difference = std::numeric_limits<qint64>::max(); + int foundTypeId = -1; int timelineModel = -1; int timelineIndex = -1; foreach (const Timeline::TimelineModel *model, timelineModels()) { @@ -42,14 +46,33 @@ int QmlProfilerNotesModel::addQmlNote(int typeId, qint64 start, qint64 duration, for (int i = model->firstIndex(start); i <= model->lastIndex(start + duration); ++i) { if (i < 0) continue; - if (model->typeId(i) == typeId && model->startTime(i) == start && - model->duration(i) == duration) { + if (collapsedRow != -1 && collapsedRow != model->collapsedRow(i)) + continue; + + qint64 modelStart = model->startTime(i); + qint64 modelDuration = model->duration(i); + + if (modelStart + modelDuration < start || start + duration < modelStart) + continue; + + // Accept different type IDs if row and time stamps match. + // Some models base their type IDs on data from secondary events which may get + // stripped by range restrictions. + int modelTypeId = model->typeId(i); + if (foundTypeId == typeId && modelTypeId != typeId) + continue; + + qint64 newDifference = qAbs(modelStart - start) + qAbs(modelDuration - duration); + if (newDifference < difference) { timelineModel = model->modelId(); timelineIndex = i; - break; + difference = newDifference; + foundTypeId = modelTypeId; + if (difference == 0 && modelTypeId == typeId) + break; } } - if (timelineIndex != -1) + if (difference == 0 && foundTypeId == typeId) break; } } @@ -64,10 +87,10 @@ int QmlProfilerNotesModel::addQmlNote(int typeId, qint64 start, qint64 duration, void QmlProfilerNotesModel::loadData() { blockSignals(true); - TimelineNotesModel::clear(); for (int i = 0; i != m_notes.size(); ++i) { - const QmlNote ¬e = m_notes[i]; - addQmlNote(note.typeIndex(), note.startTime(), note.duration(), note.text()); + QmlNote ¬e = m_notes[i]; + note.setLoaded(addQmlNote(note.typeIndex(), note.collapsedRow(), note.startTime(), + note.duration(), note.text()) != -1); } resetModified(); blockSignals(false); @@ -76,7 +99,11 @@ void QmlProfilerNotesModel::loadData() void QmlProfilerNotesModel::saveData() { - m_notes.clear(); + // Keep notes that are outside the given range, overwrite the ones inside the range. + m_notes = Utils::filtered(m_notes, [](const QmlNote ¬e) { + return !note.loaded(); + }); + for (int i = 0; i < count(); ++i) { const Timeline::TimelineModel *model = timelineModelByModelId(timelineModel(i)); if (!model) @@ -85,6 +112,7 @@ void QmlProfilerNotesModel::saveData() int index = timelineIndex(i); QmlNote save = { model->typeId(index), + model->collapsedRow(index), model->startTime(index), model->duration(index), text(i) diff --git a/src/plugins/qmlprofiler/qmlprofilernotesmodel.h b/src/plugins/qmlprofiler/qmlprofilernotesmodel.h index dc3493ce17d..e2b683fd79f 100644 --- a/src/plugins/qmlprofiler/qmlprofilernotesmodel.h +++ b/src/plugins/qmlprofiler/qmlprofilernotesmodel.h @@ -47,6 +47,7 @@ public: protected: QVector<QmlNote> m_notes; - int addQmlNote(int typeId, qint64 startTime, qint64 duration, const QString &text); + int addQmlNote(int typeId, int collapsedRow, qint64 startTime, qint64 duration, + const QString &text); }; } // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp index 3b8ea4ff8cf..67188e32fa1 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp @@ -525,7 +525,11 @@ void QmlProfilerFileReader::loadNotes(QXmlStreamReader &stream) if (elementName == _("note")) { updateProgress(stream.device()); QXmlStreamAttributes attrs = stream.attributes(); + int collapsedRow = attrs.hasAttribute(_("collapsedRow")) ? + attrs.value(_("collapsedRow")).toInt() : -1; + currentNote = QmlNote(attrs.value(_("eventIndex")).toInt(), + collapsedRow, attrs.value(_("startTime")).toLongLong(), attrs.value(_("duration")).toLongLong()); } @@ -751,6 +755,7 @@ void QmlProfilerFileWriter::saveQtd(QIODevice *device) stream.writeAttribute(_("startTime"), QString::number(note.startTime())); stream.writeAttribute(_("duration"), QString::number(note.duration())); stream.writeAttribute(_("eventIndex"), QString::number(note.typeIndex())); + stream.writeAttribute(_("collapsedRow"), QString::number(note.collapsedRow())); stream.writeCharacters(note.text()); stream.writeEndElement(); // note incrementProgress(); diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index 7a90886cc56..e50c4d82947 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -46,6 +46,7 @@ #include "timeline/timelinemodelaggregator.h" #include "timeline/timelinerenderer.h" #include "timeline/timelineoverviewrenderer.h" +#include "timeline/timelinetheme.h" #include <aggregation/aggregate.h> // Needed for the load&save actions in the context menu @@ -143,6 +144,8 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin setMinimumHeight(170); + Timeline::TimelineTheme::setupTheme(d->m_mainView->engine()); + d->m_mainView->rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"), d->m_modelProxy); d->m_mainView->rootContext()->setContextProperty(QLatin1String("zoomControl"), diff --git a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp index 78bbfee830b..c8a6beaeaee 100644 --- a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp @@ -84,7 +84,7 @@ void FlameGraphModelTest::generateData(QmlProfilerModelManager *manager) manager->acquiringDone(); - manager->notesModel()->setNotes(QVector<QmlNote>({QmlNote(0, 1, 20, "dings")})); + manager->notesModel()->setNotes(QVector<QmlNote>({QmlNote(0, 2, 1, 20, "dings")})); manager->notesModel()->loadData(); QCOMPARE(manager->state(), QmlProfilerModelManager::Done); diff --git a/src/plugins/qmlprofiler/tests/qmlnote_test.cpp b/src/plugins/qmlprofiler/tests/qmlnote_test.cpp index e4e455095ac..7e6ca6ef807 100644 --- a/src/plugins/qmlprofiler/tests/qmlnote_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlnote_test.cpp @@ -45,7 +45,7 @@ void QmlNoteTest::testAccessors() note.setText("blah"); QCOMPARE(note.text(), QString("blah")); - QmlNote note2(8, 9, 10, "semmeln"); + QmlNote note2(8, 5, 9, 10, "semmeln"); QCOMPARE(note2.typeIndex(), 8); QCOMPARE(note2.startTime(), 9); QCOMPARE(note2.duration(), 10); @@ -54,7 +54,7 @@ void QmlNoteTest::testAccessors() void QmlNoteTest::testStreamOps() { - QmlNote note(4, 5, 6, "eheheh"); + QmlNote note(4, 1, 5, 6, "eheheh"); QBuffer wbuffer; wbuffer.open(QIODevice::WriteOnly); diff --git a/src/plugins/qnx/qnxtoolchain.cpp b/src/plugins/qnx/qnxtoolchain.cpp index ad0cd53e184..6eda4a2e7a8 100644 --- a/src/plugins/qnx/qnxtoolchain.cpp +++ b/src/plugins/qnx/qnxtoolchain.cpp @@ -114,7 +114,10 @@ QString QnxToolChain::ndkPath() const void QnxToolChain::setNdkPath(const QString &ndkPath) { + if (m_ndkPath == ndkPath) + return; m_ndkPath = ndkPath; + toolChainUpdated(); } // qcc doesn't support a "-dumpmachine" option to get supported abis diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index 3ccfb4ada80..9a3f2c8b691 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -328,10 +328,8 @@ void QtOptionsPageWidget::cleanUpQtVersions() QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) return; - foreach (QtVersionItem *item, toRemove) { - m_model->takeItem(item); - delete item; - } + foreach (QtVersionItem *item, toRemove) + m_model->destroyItem(item); updateCleanUpButton(); } @@ -526,10 +524,8 @@ void QtOptionsPageWidget::updateQtVersions(const QList<int> &additions, const QL }); // Remove changed/removed items: - foreach (QtVersionItem *item, toRemove) { - m_model->takeItem(item); - delete item; - } + foreach (QtVersionItem *item, toRemove) + m_model->destroyItem(item); // Add changed/added items: foreach (int a, toAdd) { @@ -620,8 +616,7 @@ void QtOptionsPageWidget::removeQtDir() if (!item) return; - m_model->takeItem(item); - delete item; + m_model->destroyItem(item); updateCleanUpButton(); } diff --git a/src/plugins/todo/todooutputpane.cpp b/src/plugins/todo/todooutputpane.cpp index 85ccce27bf3..e0099626ee0 100644 --- a/src/plugins/todo/todooutputpane.cpp +++ b/src/plugins/todo/todooutputpane.cpp @@ -67,11 +67,7 @@ QWidget *TodoOutputPane::outputWidget(QWidget *parent) QList<QWidget*> TodoOutputPane::toolBarWidgets() const { - return QList<QWidget*>() - << m_spacer - << m_currentFileButton - << m_wholeProjectButton - << m_subProjectButton; + return { m_spacer, m_currentFileButton, m_wholeProjectButton, m_subProjectButton }; } QString TodoOutputPane::displayName() const diff --git a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp index a5f0a765ddb..a137948cc05 100644 --- a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp +++ b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp @@ -279,7 +279,7 @@ QVariant FrameItem::data(int column, int role) const return QVariant::fromValue(getErrorItem()->error()); case Qt::DisplayRole: { const int row = parent()->children().indexOf(const_cast<FrameItem *>(this)) + 1; - const int padding = static_cast<int>(std::log10(parent()->rowCount())) + const int padding = static_cast<int>(std::log10(parent()->childCount())) - static_cast<int>(std::log10(row)); return QString::fromLatin1("%1%2: %3") .arg(QString(padding, QLatin1Char(' '))) diff --git a/src/plugins/winrt/winrtdebugsupport.cpp b/src/plugins/winrt/winrtdebugsupport.cpp index 14f54e89cd2..89cca7dd664 100644 --- a/src/plugins/winrt/winrtdebugsupport.cpp +++ b/src/plugins/winrt/winrtdebugsupport.cpp @@ -53,7 +53,7 @@ WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl, WinRtRunnerHelper * , m_debugRunControl(runControl) , m_runner(runner) { - connect(m_debugRunControl, SIGNAL(finished()), this, SLOT(finish())); + connect(m_debugRunControl, &RunControl::finished, this, &WinRtDebugSupport::finish); } bool WinRtDebugSupport::useQmlDebugging(WinRtRunConfiguration *runConfig) diff --git a/src/plugins/winrt/winrtdebugsupport.h b/src/plugins/winrt/winrtdebugsupport.h index 82705576fa1..32869bba3bb 100644 --- a/src/plugins/winrt/winrtdebugsupport.h +++ b/src/plugins/winrt/winrtdebugsupport.h @@ -47,14 +47,13 @@ public: private: WinRtDebugSupport(ProjectExplorer::RunControl *runControl, WinRtRunnerHelper *runner); + void finish(); + static bool useQmlDebugging(WinRtRunConfiguration *runConfig); static bool getFreePort(Utils::Port &qmlDebuggerPort, QString *errorMessage); ProjectExplorer::RunControl *m_debugRunControl; WinRtRunnerHelper *m_runner; - -private slots: - void finish(); }; } // namespace Internal diff --git a/src/plugins/winrt/winrtdevicefactory.cpp b/src/plugins/winrt/winrtdevicefactory.cpp index 900d88faf1d..1462534af9d 100644 --- a/src/plugins/winrt/winrtdevicefactory.cpp +++ b/src/plugins/winrt/winrtdevicefactory.cpp @@ -102,9 +102,12 @@ void WinRtDeviceFactory::autoDetect() if (!m_process) { m_process = new Utils::QtcProcess(this); - connect(m_process, SIGNAL(error(QProcess::ProcessError)), SLOT(onProcessError())); - connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), - SLOT(onProcessFinished(int,QProcess::ExitStatus))); + connect(m_process, + static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), + this, &WinRtDeviceFactory::onProcessError); + connect(m_process, + static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), + this, &WinRtDeviceFactory::onProcessFinished); } const QString args = QStringLiteral("--list-devices"); diff --git a/src/plugins/winrt/winrtdevicefactory.h b/src/plugins/winrt/winrtdevicefactory.h index edb938e806f..a3729de0888 100644 --- a/src/plugins/winrt/winrtdevicefactory.h +++ b/src/plugins/winrt/winrtdevicefactory.h @@ -43,15 +43,13 @@ public: bool canRestore(const QVariantMap &map) const; ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const; -public slots: void autoDetect(); void onPrerequisitesLoaded(); -private slots: +private: void onProcessError(); void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); -private: static bool allPrerequisitesLoaded(); QString findRunnerFilePath() const; void parseRunnerOutput(const QByteArray &output) const; diff --git a/src/plugins/winrt/winrtpackagedeploymentstepwidget.h b/src/plugins/winrt/winrtpackagedeploymentstepwidget.h index 14be99b2dca..31a30aaff6a 100644 --- a/src/plugins/winrt/winrtpackagedeploymentstepwidget.h +++ b/src/plugins/winrt/winrtpackagedeploymentstepwidget.h @@ -44,11 +44,10 @@ public: virtual QString summaryText() const; virtual QString displayName() const; -private slots: +private: void on_btnRestoreDefaultArgs_clicked(); void on_leArguments_textChanged(QString str); -private: Ui::WinRtPackageDeploymentStepWidget *m_ui; WinRtPackageDeploymentStep *m_step; }; diff --git a/src/plugins/winrt/winrtrunconfiguration.h b/src/plugins/winrt/winrtrunconfiguration.h index bfff934ffb5..dc4d6e15e60 100644 --- a/src/plugins/winrt/winrtrunconfiguration.h +++ b/src/plugins/winrt/winrtrunconfiguration.h @@ -45,14 +45,12 @@ public: const QString &proFilePath() const { return m_proFilePath; } QString arguments() const; bool uninstallAfterStop() const { return m_uninstallAfterStop; } + void setUninstallAfterStop(bool b); signals: void argumentsChanged(QString); void uninstallAfterStopChanged(bool); -public slots: - void setUninstallAfterStop(bool b); - private: QString m_proFilePath; bool m_uninstallAfterStop; diff --git a/src/plugins/winrt/winrtruncontrol.cpp b/src/plugins/winrt/winrtruncontrol.cpp index 900b9ea49da..9bb06b086a4 100644 --- a/src/plugins/winrt/winrtruncontrol.cpp +++ b/src/plugins/winrt/winrtruncontrol.cpp @@ -108,9 +108,9 @@ bool WinRtRunControl::startWinRtRunner() { QTC_ASSERT(!m_runner, return false); m_runner = new WinRtRunnerHelper(this); - connect(m_runner, SIGNAL(started()), SLOT(onProcessStarted())); - connect(m_runner, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(onProcessFinished())); - connect(m_runner, SIGNAL(error(QProcess::ProcessError)), SLOT(onProcessError())); + connect(m_runner, &WinRtRunnerHelper::started, this, &WinRtRunControl::onProcessStarted); + connect(m_runner, &WinRtRunnerHelper::finished, this, &WinRtRunControl::onProcessFinished); + connect(m_runner, &WinRtRunnerHelper::error, this, &WinRtRunControl::onProcessError); m_state = StartingState; m_runner->start(); return true; diff --git a/src/plugins/winrt/winrtruncontrol.h b/src/plugins/winrt/winrtruncontrol.h index e7238d7cad2..7f69fc5af16 100644 --- a/src/plugins/winrt/winrtruncontrol.h +++ b/src/plugins/winrt/winrtruncontrol.h @@ -54,13 +54,12 @@ public: StopResult stop() override; bool isRunning() const override; -private slots: +private: + enum State { StartingState, StartedState, StoppedState }; + void onProcessStarted(); void onProcessFinished(); void onProcessError(); - -private: - enum State { StartingState, StartedState, StoppedState }; bool startWinRtRunner(); WinRtRunConfiguration *m_runConfiguration; diff --git a/src/plugins/winrt/winrtrunnerhelper.cpp b/src/plugins/winrt/winrtrunnerhelper.cpp index f8d591a1d11..038e35a8507 100644 --- a/src/plugins/winrt/winrtrunnerhelper.cpp +++ b/src/plugins/winrt/winrtrunnerhelper.cpp @@ -228,13 +228,14 @@ void WinRtRunnerHelper::startWinRtRunner(const RunConf &conf) appendMessage(QStringLiteral("winrtrunner ") + runnerArgs + QLatin1Char('\n'), NormalMessageFormat); if (connectProcess) { - connect(process, SIGNAL(started()), SIGNAL(started())); - connect(process, SIGNAL(finished(int,QProcess::ExitStatus)), - SLOT(onProcessFinished(int,QProcess::ExitStatus))); - connect(process, SIGNAL(error(QProcess::ProcessError)), - SLOT(onProcessError(QProcess::ProcessError))); - connect(process, SIGNAL(readyReadStandardOutput()), SLOT(onProcessReadyReadStdOut())); - connect(process, SIGNAL(readyReadStandardError()), SLOT(onProcessReadyReadStdErr())); + connect(process, &QProcess::started, this, &WinRtRunnerHelper::started); + connect(process, + static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), + this, &WinRtRunnerHelper::onProcessFinished); + connect(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), + this, &WinRtRunnerHelper::onProcessError); + connect(process, &QProcess::readyReadStandardOutput, this, &WinRtRunnerHelper::onProcessReadyReadStdOut); + connect(process, &QProcess::readyReadStandardError, this, &WinRtRunnerHelper::onProcessReadyReadStdErr); } process->setUseCtrlCStub(true); diff --git a/src/plugins/winrt/winrtrunnerhelper.h b/src/plugins/winrt/winrtrunnerhelper.h index 0963ff0b1be..743b5dc8c0e 100644 --- a/src/plugins/winrt/winrtrunnerhelper.h +++ b/src/plugins/winrt/winrtrunnerhelper.h @@ -63,14 +63,14 @@ signals: void finished(int exitCode, QProcess::ExitStatus exitStatus); void error(QProcess::ProcessError error); -private slots: +private: + enum RunConf { Start, Stop, Debug }; + void onProcessReadyReadStdOut(); void onProcessReadyReadStdErr(); void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); void onProcessError(QProcess::ProcessError processError); -private: - enum RunConf { Start, Stop, Debug }; void startWinRtRunner(const RunConf &conf); bool init(WinRtRunConfiguration *runConfiguration, QString *errorMessage); void appendMessage(const QString &message, Utils::OutputFormat format); diff --git a/src/shared/clang/clang_installation.pri b/src/shared/clang/clang_installation.pri index d19bab68d8a..0486d1c1707 100644 --- a/src/shared/clang/clang_installation.pri +++ b/src/shared/clang/clang_installation.pri @@ -106,6 +106,6 @@ unix { } isEmpty(LLVM_VERSION): error("Cannot determine clang version at $$LLVM_INSTALL_DIR") -!versionIsAtLeast($$LLVM_VERSION, 3, 6, 2): { - error("LLVM/Clang version >= 3.6.2 required, version provided: $$LLVM_VERSION") +!versionIsAtLeast($$LLVM_VERSION, 3, 8, 0): { + error("LLVM/Clang version >= 3.8.0 required, version provided: $$LLVM_VERSION") } diff --git a/src/src.qbs b/src/src.qbs index adc7055d216..d8ba95d0b3c 100644 --- a/src/src.qbs +++ b/src/src.qbs @@ -21,7 +21,7 @@ Project { property bool useExternalQbs: qbs_install_dir property bool buildQbsProjectManager: useExternalQbs || qbsSubModuleExists Project { - name: "qbs" + name: "qbs project" id: qbsProject property string qbsBaseDir: project.sharedSourcesDir + "/qbs" condition: qbsSubModuleExists && !useExternalQbs diff --git a/src/tools/clangbackend/ipcsource/commandlinearguments.cpp b/src/tools/clangbackend/ipcsource/commandlinearguments.cpp index d99dba9b86a..b34a76d0631 100644 --- a/src/tools/clangbackend/ipcsource/commandlinearguments.cpp +++ b/src/tools/clangbackend/ipcsource/commandlinearguments.cpp @@ -28,6 +28,7 @@ #include "clangfilepath.h" #include <utf8string.h> +#include <utils/qtcprocess.h> #include <QByteArray> @@ -71,13 +72,10 @@ const char *CommandLineArguments::at(int position) const static Utf8String maybeQuoted(const char *argumentAsCString) { - const auto quotationMark = Utf8StringLiteral("\""); - const auto argument = Utf8String::fromUtf8(argumentAsCString); + const QString argumentAsQString = QString::fromUtf8(argumentAsCString); + const QString quotedArgument = Utils::QtcProcess::quoteArg(argumentAsQString); - if (argument.contains(quotationMark)) - return argument; - - return quotationMark + argument + quotationMark; + return Utf8String::fromString(quotedArgument); } void CommandLineArguments::print() const diff --git a/src/tools/clangbackend/ipcsource/diagnostic.cpp b/src/tools/clangbackend/ipcsource/diagnostic.cpp index 87af112d9f6..5e74970ac24 100644 --- a/src/tools/clangbackend/ipcsource/diagnostic.cpp +++ b/src/tools/clangbackend/ipcsource/diagnostic.cpp @@ -150,7 +150,7 @@ QVector<SourceRangeContainer> Diagnostic::getSourceRangeContainers() const auto rangeVector = ranges(); QVector<SourceRangeContainer> sourceRangeContainers; - sourceRangeContainers.reserve(rangeVector.size()); + sourceRangeContainers.reserve(int(rangeVector.size())); for (auto &&sourceRange : rangeVector) sourceRangeContainers.push_back(sourceRange.toSourceRangeContainer()); @@ -163,7 +163,7 @@ QVector<FixItContainer> Diagnostic::getFixItContainers() const auto fixItVector = fixIts(); QVector<FixItContainer> fixItContainers; - fixItContainers.reserve(fixItVector.size()); + fixItContainers.reserve(int(fixItVector.size())); for (auto &&fixIt : fixItVector) fixItContainers.push_back(fixIt.toFixItContainer()); diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg index 91940b62aad..74c58ce6e25 100644 --- a/src/tools/icons/qtcreatoricons.svg +++ b/src/tools/icons/qtcreatoricons.svg @@ -661,6 +661,17 @@ offset="1" id="stop5101" /> </linearGradient> + <clipPath + clipPathUnits="userSpaceOnUse" + id="clipPath6127"> + <rect + style="display:inline;fill:#999999;fill-opacity:1" + x="1097" + y="568" + width="16" + height="16" + id="rect6129" /> + </clipPath> </defs> <sodipodi:namedview id="base" @@ -3035,7 +3046,7 @@ </g> <g style="display:inline" - id="src/plugins/autotest/images/expand" + id="src/plugins/coreplugin/images/expand" transform="translate(48,0)"> <rect y="568" @@ -3064,7 +3075,7 @@ inkscape:connector-curvature="0" /> </g> <g - id="src/plugins/autotest/images/collapse" + id="src/plugins/coreplugin/images/collapse" transform="translate(16,0)"> <rect style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none" @@ -3338,8 +3349,9 @@ x="1018.5" y="570.5" /> <g - id="g5932" - transform="translate(4,0)"> + id="selectArrow" + transform="translate(4,0)" + inkscape:label="#g5932"> <path sodipodi:nodetypes="ccccc" inkscape:connector-curvature="0" @@ -3400,6 +3412,120 @@ d="m 1070,583.5 3,-3 -3,-3 z" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> </g> + <g + transform="translate(32,0)" + style="display:inline" + id="src/libs/timeline/qml/ico_rangeselection"> + <rect + id="rect6782-96-0-0-7" + height="16" + width="16" + y="568" + x="1064" + style="display:inline;fill:#ffffff;fill-opacity:1" /> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path5087" + d="m 1068.5,576 7,0" + style="stroke:#000000;stroke-width:2" /> + <g + id="g5092"> + <path + d="m 1066,570 0,12" + id="path5068" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" + style="stroke:#000000;stroke-width:2" /> + <path + style="fill:#000000" + d="m 1067,576 3,-3 0,6" + id="path5090" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccc" /> + </g> + <use + height="100%" + width="100%" + transform="matrix(-1,0,0,1,2144,0)" + id="use5096" + xlink:href="#g5092" + y="0" + x="0" /> + </g> + <g + transform="translate(32,0)" + style="display:inline" + id="src/libs/timeline/qml/ico_rangeselected"> + <use + height="100%" + width="100%" + transform="translate(-16,0)" + id="use5136" + xlink:href="#src/libs/timeline/qml/ico_rangeselection" + y="0" + x="0" /> + <rect + y="570.5" + x="1082.5" + height="11" + width="11" + id="rect5138" + style="fill:#000000;fill-opacity:0.15686275;stroke:#000000" /> + </g> + <g + style="display:inline" + id="src/libs/timeline/qml/ico_selectionmode" + clip-path="url(#clipPath6127)" + transform="translate(31,0)"> + <rect + style="display:inline;fill:#ffffff;fill-opacity:1" + x="1097" + y="568" + width="16" + height="16" + id="rect6782-96-0-0-7-8" /> + <rect + y="570" + x="1099" + height="5" + width="3" + id="rect5184" + style="fill:#000000" /> + <use + height="100%" + width="100%" + transform="translate(4,0)" + id="use5201" + xlink:href="#rect5184" + y="0" + x="0" /> + <use + x="0" + y="0" + xlink:href="#rect5184" + id="use5071" + transform="translate(8,0)" + width="100%" + height="100%" /> + <use + height="100%" + width="100%" + id="use5159" + xlink:href="#selectArrow" + y="0" + x="0" + style="display:inline" + transform="translate(80,2.0000004e-7)" /> + <use + height="100%" + width="100%" + transform="translate(0,6)" + id="use5203" + xlink:href="#rect5184" + y="0" + x="0" /> + </g> </g> <g inkscape:groupmode="layer" diff --git a/tests/auto/utils/treemodel/tst_treemodel.cpp b/tests/auto/utils/treemodel/tst_treemodel.cpp index 974294d8e11..603a92dc5b8 100644 --- a/tests/auto/utils/treemodel/tst_treemodel.cpp +++ b/tests/auto/utils/treemodel/tst_treemodel.cpp @@ -79,7 +79,7 @@ void tst_TreeModel::testIteration() group2->appendChild(item21); group2->appendChild(item22); - QCOMPARE(r->rowCount(), 3); + QCOMPARE(r->childCount(), 3); QCOMPARE(countLevelItems(r, 1), 3); QCOMPARE(countLevelItems(r, 2), 6); QCOMPARE(countLevelItems(r, 3), 0); diff --git a/tests/system/objects.map b/tests/system/objects.map index fbb493d31e3..29b6fcbe8da 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -53,7 +53,7 @@ :Compiler:_QComboBox {aboveWidget=':Path.Utils_BaseValidatingLineEdit' container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':Compiler:_QLabel' type='QComboBox' unnamed='1' visible='1'} :Compiler:_QLabel {container=':qt_tabwidget_stackedwidget_QWidget' text='Compiler:' type='QLabel' unnamed='1' visible='1'} :Core__Internal__GeneralSettings.User Interface_QGroupBox {container=':qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget' name='interfaceBox' title='User Interface' type='QGroupBox' visible='1'} -:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget' name='groupBox' title='Behavior' type='QGroupBox' visible='1'} +:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='groupBox' title='Behavior' type='QGroupBox' visible='1'} :DebugModeWidget.Debugger Log_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.OutputDockWidget' type='QDockWidget' visible='1'} :DebugModeWidget.Debugger.Docks.BreakDockWidget_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.BreakDockWidget' type='QDockWidget' visible='1'} :DebugModeWidget.Debugger.Docks.LocalsAndWatchersDockWidget_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.LocalsAndWatchersDockWidget' type='QDockWidget' visible='1'} @@ -213,7 +213,6 @@ :qdesigner_internal::WidgetBoxCategoryListView {container=':Widget Box_qdesigner_internal::WidgetBoxTreeWidget' occurrence='3' type='qdesigner_internal::WidgetBoxCategoryListView' unnamed='1' visible='1'} :qmakeCallEdit {container=':Qt Creator.scrollArea_QScrollArea' text?='<b>qmake:</b> qmake*' type='QLabel' unnamed='1' visible='1'} :qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='Core__Internal__GeneralSettings' type='QWidget' visible='1'} -:qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='CppTools__Internal__CompletionSettingsPage' type='QWidget' visible='1'} :qt_tabwidget_stackedwidget.Form_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='Help__Internal__GeneralSettingsPage' type='QWidget' visible='1' windowTitle='Form'} :qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='QtSupport__Internal__QtVersionManager' type='QtSupport::Internal::QtOptionsPageWidget' visible='1'} :qt_tabwidget_stackedwidget_QScrollArea {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' type='QScrollArea' unnamed='1' visible='1'} diff --git a/tests/system/suite_CSUP/tst_CSUP02/test.py b/tests/system/suite_CSUP/tst_CSUP02/test.py index 7e26bafba47..aacd96a13d7 100644 --- a/tests/system/suite_CSUP/tst_CSUP02/test.py +++ b/tests/system/suite_CSUP/tst_CSUP02/test.py @@ -48,6 +48,8 @@ def main(): type(editorWidget, "<Return>") type(editorWidget, "<Up>") type(editorWidget, "class") + if useClang and JIRA.isBugStillOpen(15639): + snooze(8) if platform.system() == "Darwin": type(editorWidget, "<Meta+Space>") else: diff --git a/tests/system/suite_editors/tst_memberoperator/test.py b/tests/system/suite_editors/tst_memberoperator/test.py index b02271ac3e7..36db7f66181 100644 --- a/tests/system/suite_editors/tst_memberoperator/test.py +++ b/tests/system/suite_editors/tst_memberoperator/test.py @@ -43,8 +43,8 @@ def main(): typeLines(cppwindow, ("<Up>", testData.field(record, "declaration"))) type(cppwindow, testData.field(record, "usage")) snooze(1) # maybe find something better - if useClang: - snooze(1) # QTCREATORBUG-15639 + if useClang and JIRA.isBugStillOpen(15639): + snooze(1) type(cppwindow, testData.field(record, "operator")) waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500) found = str(lineUnderCursor(cppwindow)).strip() diff --git a/tests/unit/unittest/clangfixitoperationtest.cpp b/tests/unit/unittest/clangfixitoperationtest.cpp index 397cebebad1..ab01f1b103d 100644 --- a/tests/unit/unittest/clangfixitoperationtest.cpp +++ b/tests/unit/unittest/clangfixitoperationtest.cpp @@ -58,7 +58,7 @@ MATCHER_P(MatchText, expectedText, + " expected text:\n" + PrintToString(expectedText)) { const ::ClangFixItOperation &operation = arg; - QString resultText = operation.refactoringFileContent_forTestOnly(); + QString resultText = operation.firstRefactoringFileContent_forTestOnly(); if (resultText != expectedText) { *result_listener << "\n" << resultText.toUtf8().constData(); @@ -95,7 +95,7 @@ protected: TEST_F(ClangFixItOperation, Description) { - ::ClangFixItOperation operation(semicolonFilePath, diagnosticText, {semicolonFixItContainer}); + ::ClangFixItOperation operation(diagnosticText, {semicolonFixItContainer}); ASSERT_THAT(operation.description(), QStringLiteral("Apply Fix: expected ';' at end of declaration")); @@ -103,7 +103,7 @@ TEST_F(ClangFixItOperation, Description) TEST_F(ClangFixItOperation, AppendSemicolon) { - ::ClangFixItOperation operation(semicolonFilePath, diagnosticText, {semicolonFixItContainer}); + ::ClangFixItOperation operation(diagnosticText, {semicolonFixItContainer}); operation.perform(); @@ -112,7 +112,7 @@ TEST_F(ClangFixItOperation, AppendSemicolon) TEST_F(ClangFixItOperation, ComparisonVersusAssignmentChooseComparison) { - ::ClangFixItOperation operation(compareFilePath, diagnosticText, {compareFixItContainer}); + ::ClangFixItOperation operation(diagnosticText, {compareFixItContainer}); operation.perform(); @@ -121,8 +121,7 @@ TEST_F(ClangFixItOperation, ComparisonVersusAssignmentChooseComparison) TEST_F(ClangFixItOperation, ComparisonVersusAssignmentChooseParentheses) { - ::ClangFixItOperation operation(compareFilePath, - diagnosticText, + ::ClangFixItOperation operation(diagnosticText, {assignmentFixItContainerParenLeft, assignmentFixItContainerParenRight}); |