Merge remote-tracking branch 'origin/4.10'

Change-Id: Iaf27911e4e9fb762c1a24c84c458462bafe95728
This commit is contained in:
Tim Jenssen
2019-07-12 15:53:56 +02:00
126 changed files with 9456 additions and 6532 deletions

View File

@@ -20,6 +20,7 @@ imagedirs = ../images \
../../src/plugins/qmldesigner/components/formeditor \ ../../src/plugins/qmldesigner/components/formeditor \
../../src/plugins/qmldesigner/components/navigator \ ../../src/plugins/qmldesigner/components/navigator \
../../src/plugins/qmldesigner/components/timelineeditor/images \ ../../src/plugins/qmldesigner/components/timelineeditor/images \
../../src/plugins/qmldesigner/qmlpreviewplugin/images \
../../src/plugins/scxmleditor/common/images \ ../../src/plugins/scxmleditor/common/images \
../../src/plugins/texteditor/images \ ../../src/plugins/texteditor/images \
../../src/plugins/valgrind/images ../../src/plugins/valgrind/images

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -103,12 +103,12 @@
\image qtcreator-clang-tools.png "Clang-Tidy and Clazy view" \image qtcreator-clang-tools.png "Clang-Tidy and Clazy view"
Select the link in the \uicontrol Location column to move to the location Double-click an issue to move to the location where the issue appears in
where the issue appears in the code editor. the code editor.
In the \uicontrol {Fixit Status} column, select issues that you want to If a fixit exists for an issue, you can select the check box next to the
apply refactoring actions to, and then select \uicontrol {Apply Fixits}. issue to schedule it for fixing. You can see the status of the issue by
The status of the issues is updated in the \uicontrol {Fixit Status} column. hovering the mouse pointer over the icon next to the check box.
\section1 Configuring Clang Tools \section1 Configuring Clang Tools

View File

@@ -371,8 +371,12 @@
To search within the \uicontrol{Application Output} and \uicontrol{Compile Output} To search within the \uicontrol{Application Output} and \uicontrol{Compile Output}
panes, press \key {Ctrl+F} when the pane is active. Enter search criteria in panes, press \key {Ctrl+F} when the pane is active. Enter search criteria in
the \uicontrol Find field and click the left and right arrows to search down and the \uicontrol Find field and click the left and right arrows to search down and
up in the pane. In these panes, you can also use the zoom buttons to increase and up in the pane.
decrease the text size of the output.
To increase or decrease the output text size, select \inlineimage plus.png
(\uicontrol {Zoom In}) or \inlineimage minus.png
(\uicontrol {Zoom Out}), or press \key Ctrl++ or \key Ctrl+-. Zooming is
not supported in all output panes.
To filter the output, enter a string in the \uicontrol Filter field. To filter the output, enter a string in the \uicontrol Filter field.
Filtering is not supported in all output panes. Filtering is not supported in all output panes.

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -33,7 +33,7 @@
\contentspage index.html \contentspage index.html
\previouspage creator-scxml.html \previouspage creator-scxml.html
\page creator-building-running.html \page creator-building-running.html
\nextpage creator-building-targets.html \nextpage creator-live-preview.html
\title Building and Running \title Building and Running
@@ -46,6 +46,14 @@
running your project. running your project.
\list \list
\li \l {Previewing}
You can use the QML live preview to preview a QML file or an
entire Qt Quick application on the desktop, as well as on
Android and embedded Linux devices. The changes you make to
the UI are instantly visible to you in the preview.
\li \l{Building for Multiple Platforms} \li \l{Building for Multiple Platforms}
\e {Build configurations} contain everything you need to compile \e {Build configurations} contain everything you need to compile

View File

@@ -256,6 +256,8 @@
For more information about creating Qt Quick projects, see For more information about creating Qt Quick projects, see
\l {Creating Qt Quick Projects}. \l {Creating Qt Quick Projects}.
\include creator-python-project.qdocinc python project wizards
\section1 Adding Files to Projects \section1 Adding Files to Projects
You can use wizards also to add individual files to your projects. You can use wizards also to add individual files to your projects.
@@ -408,8 +410,6 @@
The above functions are also available in the context menu in the The above functions are also available in the context menu in the
\uicontrol Projects view. \uicontrol Projects view.
\include creator-python-project.qdocinc python project wizards
\section2 Creating OpenGL Fragment and Vertex Shaders \section2 Creating OpenGL Fragment and Vertex Shaders
Qt provides support for integration with OpenGL implementations on all Qt provides support for integration with OpenGL implementations on all

View File

@@ -269,9 +269,12 @@
To add a variable value to the environment, enter the variable name and To add a variable value to the environment, enter the variable name and
value, separated by the equals sign. For example, the following line value, separated by the equals sign. For example, the following line
prepends \c /opt/bin to the existing PATH: prepends the \c /opt/bin folder to the existing PATH:
\c {PATH=/opt/bin:${PATH}} \list
\li On Windows: \c {PATH=C:\opt\bin;${PATH}}
\li On Linux: \c {PATH=/opt/bin:${PATH}}
\endlist
To add or remove several variables, place them on separate lines. The order To add or remove several variables, place them on separate lines. The order
is important. If you remove a value on a line, you cannot refer to it on the is important. If you remove a value on a line, you cannot refer to it on the

View File

@@ -42,22 +42,28 @@
use \c {.pyqtc} files, but we recommend that you choose \c{.pyproject} files use \c {.pyqtc} files, but we recommend that you choose \c{.pyproject} files
for new projects. for new projects.
The Window wizard adds the following imports to the \c {main.py} The \uicontrol {Qt for Python - Window} wizard enables you to create a
file to provide access to the QApplication and QMainWindow classes Python source file for a new class that you can add to a Python project.
in the Qt Widgets module: Specify the class name, base class, and and source file for the class.
\image qtcreator-python-wizard-app-window.png
The Window wizard adds the imports to the source file to provide
access to the QApplication and the base class you selected in the Qt
Widgets module:
\badcode \badcode
import sys import sys
from PySide2.QtWidgets import QApplication, QMainWindow from PySide2.QtWidgets import QApplication, QWidget
\endcode \endcode
The Window wizard also adds a \c MainWindow class that inherits from The Window wizard also adds a main class with the specified name that
QMainWindow: inherits from the specified base class:
\badcode \badcode
class MainWindow(QMainWindow): class MyWidget(QWidget):
def __init__(self): def __init__(self):
QMainWindow.__init__(self) QWidget.__init__(self)
\endcode \endcode
Next, the Window wizard adds a main function, where it creates a Next, the Window wizard adds a main function, where it creates a
@@ -68,13 +74,12 @@
\badcode \badcode
if __name__ == "__main__": if __name__ == "__main__":
app = QApplication([]) app = QApplication([])
...
\endcode \endcode
Next, the Window wizard instantiates the \c MainWindow class and shows it: Next, the Window wizard instantiates the \c MainWindow class and shows it:
\badcode \badcode
window = MainWindow() window = MyWidget()
window.show() window.show()
... ...
\endcode \endcode
@@ -86,7 +91,7 @@
sys.exit(app.exec_()) sys.exit(app.exec_())
\endcode \endcode
The Empty wizard adds similar code to the \c {main.py} file, but it does The Empty wizard adds similar code to the source file, but it does
not add any classes, so you need to add and instantiate them yourself. not add any classes, so you need to add and instantiate them yourself.
For examples of creating Qt for Python applications, see For examples of creating Qt for Python applications, see

View File

@@ -156,6 +156,11 @@
\endlist \endlist
\li \l{Building and Running} \li \l{Building and Running}
\list \list
\li \l{Previewing}
\list
\li \l{Previewing on Desktop}
\li \l{Previewing on Devices}
\endlist
\li \l{Building for Multiple Platforms} \li \l{Building for Multiple Platforms}
\li \l{Running on Multiple Platforms} \li \l{Running on Multiple Platforms}
\li \l{Deploying to Devices} \li \l{Deploying to Devices}

View File

@@ -94,6 +94,7 @@
\row \row
\li \b {\l{Building and Running}} \li \b {\l{Building and Running}}
\list \list
\li \l{Previewing}
\li \l{Building for Multiple Platforms} \li \l{Building for Multiple Platforms}
\li \l{Running on Multiple Platforms} \li \l{Running on Multiple Platforms}
\li \l{Deploying to Devices} \li \l{Deploying to Devices}

View File

@@ -34,7 +34,7 @@
\contentspage index.html \contentspage index.html
\previouspage creator-visual-editor.html \previouspage creator-visual-editor.html
\page quick-projects.html \page quick-projects.html
\nextpage creator-quick-ui-forms.html \nextpage creator-using-qt-quick-designer.html
\title Creating Qt Quick Projects \title Creating Qt Quick Projects

View File

@@ -36,7 +36,7 @@
\previouspage creator-modes.html \previouspage creator-modes.html
\nextpage {Tutorials} \nextpage {Tutorials}
\else \else
\previouspage creator-quick-ui-forms.html \previouspage quick-projects.html
\nextpage quick-components.html \nextpage quick-components.html
\endif \endif

View File

@@ -0,0 +1,70 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Design Studio documentation.
**
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\contentspage {Qt Creator}
\previouspage creator-live-preview.html
\page creator-live-preview-desktop.html
\nextpage creator-live-preview-devices.html
\title Previewing on Desktop
To preview the currently active QML file on the desktop:
\list
\li Select \uicontrol Build > \uicontrol {QML Preview}.
\li Select the \inlineimage live_preview.png
(\uicontrol {Show Live Preview}) button.
\li Press \key {Alt+P}.
\endlist
\if defined(qtcreator)
\image qtcreator-live-preview.png
\else
\image studio-live-preview.png
\endif
To preview any QML file that belongs to the project, right-click the project
name in the \uicontrol Project tab in the \uicontrol Navigator, and select
\uicontrol {Preview file}.
To preview the whole UI, select \uicontrol {Show Live Preview}
when viewing the main QML UI file of the project.
To view the UI in different sizes, select the zooming level on the toolbar.
The frames-per-second (FPS) refresh rate of animations is displayed in the
\uicontrol FPS field.
\if defined(qtdesignstudio)
\section1 Selecting the Preview Tool
By default, the \c qmlscene utility is used for previewing. To use some
other tool, specify it in the \uicontrol {QML viewer} field in the run
settings of the project in the Projects mode.
\image studio-run-settings.png "Run settings"
\endif
*/

View File

@@ -0,0 +1,104 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Design Studio documentation.
**
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\contentspage {Qt Creator}
\previouspage creator-live-preview-desktop.html
\page creator-live-preview-devices.html
\if defined(qtdesignstudio)
\nextpage studio-advanced.html
\else
\nextpage creator-building-targets.html
\endif
\title Previewing on Devices
\omit
To preview UIs on Android devices, you need to enable USB debugging on them
and connect them to your system with a USB cable.
\endomit
To preview UIs on embedded devices, you need to connect the devices to your
system with a USB cable, or a wired or wireless connection, depending on
the device, and configure connections to them. The necessary kits have been
predefined and you only need to enable them for your current project.
\e {Deploy configurations} handle the packaging and copying of the
necessary files to a location in a device where you want to run the
executable at.
To preview a UI on a device:
\list 1
\li In \uicontrol Projects > \uicontrol {Build & Run}, enable the kit
predefined for the device type (1).
\li Select the kit for the device in the kit selector (2).
\if defined(qtcreator)
\image qtcreator-live-preview-kit.png
\else
\image studio-kit-selector.png "Kit selector"
\endif
\li Select \uicontrol Build > \uicontrol {QML Preview} or
press \key {Alt+P}.
\endlist
\omit
\section2 Previewing on Android Devices
The USB debugging feature on Android devices enables creating connections
to the devices from \QDS and running the live preview utility on them.
Debugging is enabled in different ways on different Android devices.
Look for \uicontrol {USB Debugging} under \uicontrol {Developer Options}.
On some devices \uicontrol {Developer Options} is hidden and becomes visible
when you tap the \uicontrol {Build number} field in \uicontrol Settings >
\uicontrol About several times.
After you have enabled debugging, connect the Android device to the system
with a USB cable.
The first time you preview a UI on devices, the preview utility
is copied to them. This might take some time. Thereafter, previewing will
get faster, because only the UI files need to be copied to the
device.
\endomit
\section2 Previewing on Embedded Devices
You can preview UIs on embedded devices that are supported by
\l{Qt for Device Creation}. For a list of supported devices, see
\l{https://doc.qt.io/QtForDeviceCreation/qtee-supported-platforms.html#reference-target-devices}
{Reference Target Devices}.
You must configure the device as instructed in the
\l{https://doc.qt.io/QtForDeviceCreation/b2qt-installation-guides.html}
{Installation Guides}.
\note At the time of this writing, \macos is not supported as a development
host for Qt for Device Creation. This means that you cannot preview UIs on
devices if you are using \QDS on \macos. For more information about
supported development hosts, see
\l {https://doc.qt.io/QtForDeviceCreation/qtdc-supported-platforms.html}
{Supported Development Hosts}.
*/

View File

@@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Design Studio documentation.
**
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\contentspage {Qt Creator}
\if defined(qtdesignstudio)
\previouspage creator-quick-ui-forms.html
\else
\previouspage creator-building-running.html
\endif
\page creator-live-preview.html
\nextpage creator-live-preview-desktop.html
\title Previewing
You can use the QML live preview to preview a QML file or the entire
UI on the desktop, as well as on Android and embedded Linux
devices. The changes you make to the UI are instantly visible
to you in the preview.
\if defined(qtcreator)
\image qtcreator-live-preview.png
\else
\image studio-live-preview.png
\endif
\list
\li \l{Previewing on Desktop}
You can preview individual QML files or the whole UI in the
Design mode.
\li \l{Previewing on Devices}
\if defined(qtcreator)
You can preview Qt Quick applications on devices that you have
connected to the development PC. For more information, see
\l {Connecting Devices}.
\else
When you install \QDS, everything you need for previewing on
devices is set up automatically. You only need to connect your
devices to your system.
\endif
\endlist
*/

View File

@@ -50,6 +50,16 @@
then select \uicontrol Reset to remove the property values before trying then select \uicontrol Reset to remove the property values before trying
again. again.
To modify the common properties of multiple items simultaneously, select
them in the \uicontrol Navigator or on the canvas:
\list
\li On Windows, press and hold \key Ctrl and \key Shift, and then click
the items to select them.
\li On \macos, press \key Shift to select a range of items or \key Cmd
to select multiple single items.
\endlist
To return an item to its implicit position after moving it, select the To return an item to its implicit position after moving it, select the
\inlineimage qtcreator-reset-position-icon.png \inlineimage qtcreator-reset-position-icon.png
(\uicontrol {Reset Position}) button on the toolbar. To return it to its (\uicontrol {Reset Position}) button on the toolbar. To return it to its

View File

@@ -35,7 +35,7 @@
\page creator-quick-ui-forms.html \page creator-quick-ui-forms.html
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
\previouspage qmldesigner-pathview-editor.html \previouspage qmldesigner-pathview-editor.html
\nextpage studio-live-preview.html \nextpage creator-live-preview.html
\else \else
\previouspage qtquick-iso-icon-browser.html \previouspage qtquick-iso-icon-browser.html
\nextpage quick-export-to-qml.html \nextpage quick-export-to-qml.html

View File

@@ -263,7 +263,10 @@
\li Show the changes in a branch. \li Show the changes in a branch.
\row \row
\li \uicontrol Reset \li \uicontrol Reset
\li Hard reset the active branch to the selected branch. \li Reset the active branch to the selected branch. You
can choose between a \uicontrol Hard, \uicontrol Mixed,
and \uicontrol Soft reset. For more information, see
\l{Resetting Local Repository}.
\row \row
\li \uicontrol Merge \li \uicontrol Merge
\li Join the development histories in two branches together. \li Join the development histories in two branches together.

View File

@@ -3,8 +3,15 @@ import qbs.FileInfo
Module { Module {
Depends { name: "qtc" } Depends { name: "qtc" }
Depends { name: "cpp" }
property bool priority: 1 // TODO: Remove declaration after 1.11 is out. Properties {
condition: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("clang")
&& Utilities.versionCompare(cpp.compilerVersion, "9") >= 0
cpp.cxxFlags: ["-Wno-deprecated-copy", "-Wno-init-list-lifetime"]
}
priority: 1
property bool enableUnitTests: false property bool enableUnitTests: false
property bool enableProjectFileUpdates: true property bool enableProjectFileUpdates: true

View File

@@ -77,7 +77,8 @@ source_include_patterns = [
r"^src/plugins/help/images/.*$", r"^src/plugins/help/images/.*$",
r"^src/plugins/projectexplorer/images/.*$", r"^src/plugins/projectexplorer/images/.*$",
r"^src/plugins/qmldesigner/components/componentcore/images/.*$", r"^src/plugins/qmldesigner/components/componentcore/images/.*$",
r"^src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/.*$", r"^src/plugins/qmldesigner/components/timelineeditor/images/.*$",
r"^src/plugins/qmldesigner/qmlpreviewplugin/images/.*$",
r"^src/plugins/texteditor/images/.*$" r"^src/plugins/texteditor/images/.*$"
# also some single files # also some single files
r"^src/plugins/qmldesigner/components/formeditor/.*\.png$", r"^src/plugins/qmldesigner/components/formeditor/.*\.png$",

View File

@@ -150,9 +150,9 @@ def main():
process = subprocess.Popen([arguments.tidypath, '-checks=*', '-list-checks'], stdout=subprocess.PIPE) process = subprocess.Popen([arguments.tidypath, '-checks=*', '-list-checks'], stdout=subprocess.PIPE)
lines = process.stdout.read().splitlines() lines = process.stdout.read().splitlines()
lines.pop(0) # 'Enabled checks:' lines.pop(0) # 'Enabled checks:'
major_checks = ['android-', 'boost-', 'bugprone-', 'cert-', 'clang-analyzer-', major_checks = ['abseil-', 'android-', 'boost-', 'bugprone-', 'cert-', 'clang-analyzer-',
'cppcoreguidelines-', 'fuchsia-', 'google-', 'hicpp-', 'llvm-', 'misc-', 'modernize-', 'cppcoreguidelines-', 'fuchsia-', 'google-', 'hicpp-', 'llvm-', 'misc-', 'modernize-',
'mpi-', 'objc-', 'performance-', 'readability-'] 'mpi-', 'objc-', 'performance-', 'portability-', 'readability-', 'zircon-']
current_major = 0 current_major = 0
major_groups = {} major_groups = {}
for line in lines: for line in lines:

View File

@@ -453,6 +453,14 @@ class Dumper(DumperBase):
self.put('],partial="%d"' % (len(self.partialVariable) > 0)) self.put('],partial="%d"' % (len(self.partialVariable) > 0))
self.put(',timings=%s' % self.timings) self.put(',timings=%s' % self.timings)
if self.forceQtNamespace:
self.qtNamespaceToReport = self.qtNamespace()
if self.qtNamespaceToReport:
self.output += ',qtnamespace="%s"' % self.qtNamespaceToReport
self.qtNamespaceToReport = None
self.reportResult(self.output, args) self.reportResult(self.output, args)
def report(self, stuff): def report(self, stuff):

View File

@@ -49,6 +49,9 @@ Item {
StudioControls.RealSpinBox { StudioControls.RealSpinBox {
id: spinBox id: spinBox
onDragStarted: hideCursor();
onDragEnded: restoreCursor();
property bool hasSlider: spinBox.sliderIndicatorVisible property bool hasSlider: spinBox.sliderIndicatorVisible
width: wrapper.width width: wrapper.width

View File

@@ -40,13 +40,21 @@ T.SpinBox {
property int decimals: 0 property int decimals: 0
property real minStepSize: 1 property real minStepSize: {
property real maxStepSize: 10 var tmpMinStepSize = Number((mySpinBox.realStepSize * 0.1).toFixed(mySpinBox.decimals))
return (tmpMinStepSize) ? tmpMinStepSize : mySpinBox.realStepSize
}
property real maxStepSize: {
var tmpMaxStepSize = Number((mySpinBox.realStepSize * 10.0).toFixed(mySpinBox.decimals))
return (tmpMaxStepSize < mySpinBox.realTo) ? tmpMaxStepSize : mySpinBox.realStepSize
}
property bool edit: spinBoxInput.activeFocus property bool edit: spinBoxInput.activeFocus
property bool hover: false // This property is used to indicate the global hover state property bool hover: false // This property is used to indicate the global hover state
property bool drag: false property bool drag: false
property real realDragRange: realTo - realFrom
property alias actionIndicatorVisible: actionIndicator.visible property alias actionIndicatorVisible: actionIndicator.visible
property real __actionIndicatorWidth: StudioTheme.Values.squareComponentWidth property real __actionIndicatorWidth: StudioTheme.Values.squareComponentWidth
property real __actionIndicatorHeight: StudioTheme.Values.height property real __actionIndicatorHeight: StudioTheme.Values.height
@@ -246,11 +254,10 @@ T.SpinBox {
onRealValueChanged: { onRealValueChanged: {
spinBoxInput.text = mySpinBox.textFromValue(mySpinBox.realValue, mySpinBox.locale) spinBoxInput.text = mySpinBox.textFromValue(mySpinBox.realValue, mySpinBox.locale)
mySpinBox.value = 0 // Without setting value back to 0, it can occur that one of mySpinBox.value = 0 // Without setting value back to 0, it can happen that one of
// the indicator will be disabled due to range logic. // the indicator will be disabled due to range logic.
} }
onRealValueModified: myTimer.restart() onRealValueModified: myTimer.restart()
onFocusChanged: mySpinBox.setValueFromInput() onFocusChanged: mySpinBox.setValueFromInput()
onDisplayTextChanged: spinBoxInput.text = mySpinBox.displayText onDisplayTextChanged: spinBoxInput.text = mySpinBox.displayText
onActiveFocusChanged: { onActiveFocusChanged: {
@@ -269,7 +276,7 @@ T.SpinBox {
// Store current step size // Store current step size
var currStepSize = mySpinBox.realStepSize var currStepSize = mySpinBox.realStepSize
// Set stepSize according to used modifier key // Set realStepSize according to used modifier key
if (event.modifiers & Qt.ControlModifier) if (event.modifiers & Qt.ControlModifier)
mySpinBox.realStepSize = mySpinBox.minStepSize mySpinBox.realStepSize = mySpinBox.minStepSize
@@ -281,7 +288,7 @@ T.SpinBox {
else else
mySpinBox.realDecrease() mySpinBox.realDecrease()
// Reset step size // Reset realStepSize
mySpinBox.realStepSize = currStepSize mySpinBox.realStepSize = currStepSize
} }

View File

@@ -76,28 +76,56 @@ TextInput {
acceptedDevices: PointerDevice.Mouse acceptedDevices: PointerDevice.Mouse
enabled: true enabled: true
property real initialValue: 0 property real initialValue: myControl.realValue
property real multiplier: 1.0
onActiveChanged: { onActiveChanged: {
if (dragHandler.active) { if (dragHandler.active) {
dragHandler.initialValue = myControl.realValue dragHandler.initialValue = myControl.realValue
mouseArea.cursorShape = Qt.ClosedHandCursor mouseArea.cursorShape = Qt.ClosedHandCursor // TODO
myControl.drag = true myControl.drag = true
myControl.dragStarted() myControl.dragStarted()
// Force focus on the non visible component to receive key events
dragModifierWorkaround.forceActiveFocus()
} else { } else {
mouseArea.cursorShape = Qt.PointingHandCursor mouseArea.cursorShape = Qt.PointingHandCursor // TODO
myControl.drag = false myControl.drag = false
myControl.dragEnded() myControl.dragEnded()
// Avoid active focus on the component after dragging
dragModifierWorkaround.focus = false
textInput.focus = false
myControl.focus = false
} }
} }
onTranslationChanged: { onTranslationChanged: calcValue()
onMultiplierChanged: calcValue()
function calcValue() {
var tmp = myControl.realDragRange / StudioTheme.Values.dragLength
var currValue = myControl.realValue var currValue = myControl.realValue
myControl.setRealValue(dragHandler.initialValue + (translation.x * myControl.realStepSize)) myControl.setRealValue(dragHandler.initialValue + (tmp * dragHandler.translation.x * dragHandler.multiplier))
if (currValue !== myControl.realValue) if (currValue !== myControl.realValue)
myControl.realValueModified() myControl.realValueModified()
} }
} }
Item {
id: dragModifierWorkaround
Keys.onPressed: {
event.accepted = true
if (event.modifiers & Qt.ControlModifier)
dragHandler.multiplier = 0.1
if (event.modifiers & Qt.ShiftModifier)
dragHandler.multiplier = 10.0
}
Keys.onReleased: {
event.accepted = true
dragHandler.multiplier = 1.0
}
}
TapHandler { TapHandler {
id: tapHandler id: tapHandler
acceptedDevices: PointerDevice.Mouse acceptedDevices: PointerDevice.Mouse
@@ -110,6 +138,9 @@ TextInput {
MouseArea { MouseArea {
id: mouseArea id: mouseArea
property real stepSize: myControl.realStepSize
anchors.fill: parent anchors.fill: parent
enabled: true enabled: true
hoverEnabled: true hoverEnabled: true
@@ -123,12 +154,22 @@ TextInput {
if (!myControl.__wheelEnabled) if (!myControl.__wheelEnabled)
return return
// Set stepSize according to used modifier key
if (wheel.modifiers & Qt.ControlModifier)
mouseArea.stepSize = myControl.minStepSize
if (wheel.modifiers & Qt.ShiftModifier)
mouseArea.stepSize = myControl.maxStepSize
var currValue = myControl.realValue var currValue = myControl.realValue
myControl.valueFromText(textInput.text, myControl.locale) myControl.valueFromText(textInput.text, myControl.locale)
myControl.setRealValue(myControl.realValue + (wheel.angleDelta.y / 120.0 * myControl.realStepSize)) myControl.setRealValue(myControl.realValue + (wheel.angleDelta.y / 120.0 * mouseArea.stepSize))
if (currValue !== myControl.realValue) if (currValue !== myControl.realValue)
myControl.realValueModified() myControl.realValueModified()
// Reset stepSize
mouseArea.stepSize = myControl.realStepSize
} }
} }
@@ -166,7 +207,7 @@ TextInput {
}, },
State { State {
name: "edit" name: "edit"
when: textInput.edit when: textInput.edit && !myControl.drag
PropertyChanges { PropertyChanges {
target: textInputArea target: textInputArea
color: StudioTheme.Values.themeFocusEdit color: StudioTheme.Values.themeFocusEdit

View File

@@ -49,6 +49,7 @@ QtObject {
property real sliderControlSize: 12 property real sliderControlSize: 12
property real sliderControlSizeMulti: values.sliderControlSize * values.scaleFactor property real sliderControlSizeMulti: values.sliderControlSize * values.scaleFactor
property int dragLength: 400 // px
property real spinControlIconSize: 8 property real spinControlIconSize: 8
property real spinControlIconSizeMulti: values.spinControlIconSize * values.scaleFactor property real spinControlIconSizeMulti: values.spinControlIconSize * values.scaleFactor

File diff suppressed because it is too large Load Diff

View File

@@ -123,9 +123,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()]. ** [sqlite_version()] and [sqlite_source_id()].
*/ */
#define SQLITE_VERSION "3.26.0" #define SQLITE_VERSION "3.28.0"
#define SQLITE_VERSION_NUMBER 3026000 #define SQLITE_VERSION_NUMBER 3028000
#define SQLITE_SOURCE_ID "2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9" #define SQLITE_SOURCE_ID "2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@@ -189,6 +189,9 @@ SQLITE_API int sqlite3_libversion_number(void);
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
SQLITE_API int sqlite3_compileoption_used(const char *zOptName); SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
SQLITE_API const char *sqlite3_compileoption_get(int N); SQLITE_API const char *sqlite3_compileoption_get(int N);
#else
# define sqlite3_compileoption_used(X) 0
# define sqlite3_compileoption_get(X) ((void*)0)
#endif #endif
/* /*
@@ -823,6 +826,15 @@ struct sqlite3_io_methods {
** file space based on this hint in order to help writes to the database ** file space based on this hint in order to help writes to the database
** file run faster. ** file run faster.
** **
** <li>[[SQLITE_FCNTL_SIZE_LIMIT]]
** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that
** implements [sqlite3_deserialize()] to set an upper bound on the size
** of the in-memory database. The argument is a pointer to a [sqlite3_int64].
** If the integer pointed to is negative, then it is filled in with the
** current limit. Otherwise the limit is set to the larger of the value
** of the integer pointed to and the current database size. The integer
** pointed to is set to the new limit.
**
** <li>[[SQLITE_FCNTL_CHUNK_SIZE]] ** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
** extends and truncates the database file in chunks of a size specified ** extends and truncates the database file in chunks of a size specified
@@ -1131,6 +1143,7 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33 #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
#define SQLITE_FCNTL_LOCK_TIMEOUT 34 #define SQLITE_FCNTL_LOCK_TIMEOUT 34
#define SQLITE_FCNTL_DATA_VERSION 35 #define SQLITE_FCNTL_DATA_VERSION 35
#define SQLITE_FCNTL_SIZE_LIMIT 36
/* deprecated names */ /* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -1972,6 +1985,17 @@ struct sqlite3_mem_methods {
** negative value for this option restores the default behaviour. ** negative value for this option restores the default behaviour.
** This option is only available if SQLite is compiled with the ** This option is only available if SQLite is compiled with the
** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
**
** [[SQLITE_CONFIG_MEMDB_MAXSIZE]]
** <dt>SQLITE_CONFIG_MEMDB_MAXSIZE
** <dd>The SQLITE_CONFIG_MEMDB_MAXSIZE option accepts a single parameter
** [sqlite3_int64] parameter which is the default maximum size for an in-memory
** database created using [sqlite3_deserialize()]. This default maximum
** size can be adjusted up or down for individual databases using the
** [SQLITE_FCNTL_SIZE_LIMIT] [sqlite3_file_control|file-control]. If this
** configuration setting is never used, then the default maximum is determined
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
** compile-time option is not set, then the default maximum is 1073741824.
** </dl> ** </dl>
*/ */
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -2002,6 +2026,7 @@ struct sqlite3_mem_methods {
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
/* /*
** CAPI3REF: Database Connection Configuration Options ** CAPI3REF: Database Connection Configuration Options
@@ -2064,8 +2089,8 @@ struct sqlite3_mem_methods {
** **
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt> ** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
** <dd> ^This option is used to enable or disable the two-argument ** <dd> ^This option is used to enable or disable the
** version of the [fts3_tokenizer()] function which is part of the ** [fts3_tokenizer()] function which is part of the
** [FTS3] full-text search engine extension. ** [FTS3] full-text search engine extension.
** There should be two additional arguments. ** There should be two additional arguments.
** The first argument is an integer which is 0 to disable fts3_tokenizer() or ** The first argument is an integer which is 0 to disable fts3_tokenizer() or
@@ -2177,6 +2202,17 @@ struct sqlite3_mem_methods {
** <li> Direct writes to [shadow tables]. ** <li> Direct writes to [shadow tables].
** </ul> ** </ul>
** </dd> ** </dd>
**
** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt>
** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the
** "writable_schema" flag. This has the same effect and is logically equivalent
** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
** The first argument to this setting is an integer which is 0 to disable
** the writable_schema, positive to enable writable_schema, or negative to
** leave the setting unchanged. The second parameter is a pointer to an
** integer into which is written 0 or 1 to indicate whether the writable_schema
** is enabled or disabled following this call.
** </dd>
** </dl> ** </dl>
*/ */
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
@@ -2190,7 +2226,8 @@ struct sqlite3_mem_methods {
#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ #define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */
#define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ #define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */
#define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ #define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */
#define SQLITE_DBCONFIG_MAX 1010 /* Largest DBCONFIG */ #define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */
#define SQLITE_DBCONFIG_MAX 1011 /* Largest DBCONFIG */
/* /*
** CAPI3REF: Enable Or Disable Extended Result Codes ** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -2347,7 +2384,7 @@ SQLITE_API int sqlite3_changes(sqlite3*);
** not. ^Changes to a view that are intercepted by INSTEAD OF triggers ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
** are not counted. ** are not counted.
** **
** This the [sqlite3_total_changes(D)] interface only reports the number ** The [sqlite3_total_changes(D)] interface only reports the number
** of rows that changed due to SQL statement run against database ** of rows that changed due to SQL statement run against database
** connection D. Any changes by other database connections are ignored. ** connection D. Any changes by other database connections are ignored.
** To detect changes against a database file from other database ** To detect changes against a database file from other database
@@ -2991,9 +3028,9 @@ SQLITE_API int sqlite3_set_authorizer(
** time is in units of nanoseconds, however the current implementation ** time is in units of nanoseconds, however the current implementation
** is only capable of millisecond resolution so the six least significant ** is only capable of millisecond resolution so the six least significant
** digits in the time are meaningless. Future versions of SQLite ** digits in the time are meaningless. Future versions of SQLite
** might provide greater resolution on the profiler callback. The ** might provide greater resolution on the profiler callback. Invoking
** sqlite3_profile() function is considered experimental and is ** either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the
** subject to change in future versions of SQLite. ** profile callback.
*/ */
SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*, SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
void(*xTrace)(void*,const char*), void*); void(*xTrace)(void*,const char*), void*);
@@ -3407,6 +3444,8 @@ SQLITE_API int sqlite3_open_v2(
** is not a database file pathname pointer that SQLite passed into the xOpen ** is not a database file pathname pointer that SQLite passed into the xOpen
** VFS method, then the behavior of this routine is undefined and probably ** VFS method, then the behavior of this routine is undefined and probably
** undesirable. ** undesirable.
**
** See the [URI filename] documentation for additional information.
*/ */
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam); SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
@@ -3629,18 +3668,23 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** deplete the limited store of lookaside memory. Future versions of ** deplete the limited store of lookaside memory. Future versions of
** SQLite may act on this hint differently. ** SQLite may act on this hint differently.
** **
** [[SQLITE_PREPARE_NORMALIZE]] ^(<dt>SQLITE_PREPARE_NORMALIZE</dt> ** [[SQLITE_PREPARE_NORMALIZE]] <dt>SQLITE_PREPARE_NORMALIZE</dt>
** <dd>The SQLITE_PREPARE_NORMALIZE flag indicates that a normalized ** <dd>The SQLITE_PREPARE_NORMALIZE flag is a no-op. This flag used
** representation of the SQL statement should be calculated and then ** to be required for any prepared statement that wanted to use the
** associated with the prepared statement, which can be obtained via ** [sqlite3_normalized_sql()] interface. However, the
** the [sqlite3_normalized_sql()] interface.)^ The semantics used to ** [sqlite3_normalized_sql()] interface is now available to all
** normalize a SQL statement are unspecified and subject to change. ** prepared statements, regardless of whether or not they use this
** At a minimum, literal values will be replaced with suitable ** flag.
** placeholders. **
** [[SQLITE_PREPARE_NO_VTAB]] <dt>SQLITE_PREPARE_NO_VTAB</dt>
** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
** to return an error (error code SQLITE_ERROR) if the statement uses
** any virtual tables.
** </dl> ** </dl>
*/ */
#define SQLITE_PREPARE_PERSISTENT 0x01 #define SQLITE_PREPARE_PERSISTENT 0x01
#define SQLITE_PREPARE_NORMALIZE 0x02 #define SQLITE_PREPARE_NORMALIZE 0x02
#define SQLITE_PREPARE_NO_VTAB 0x04
/* /*
** CAPI3REF: Compiling An SQL Statement ** CAPI3REF: Compiling An SQL Statement
@@ -3865,6 +3909,18 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
*/ */
SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
/*
** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement
** METHOD: sqlite3_stmt
**
** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the
** prepared statement S is an EXPLAIN statement, or 2 if the
** statement S is an EXPLAIN QUERY PLAN.
** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is
** an ordinary statement or a NULL pointer.
*/
SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
/* /*
** CAPI3REF: Determine If A Prepared Statement Has Been Reset ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
** METHOD: sqlite3_stmt ** METHOD: sqlite3_stmt
@@ -4004,7 +4060,9 @@ typedef struct sqlite3_context sqlite3_context;
** ^The fifth argument to the BLOB and string binding interfaces ** ^The fifth argument to the BLOB and string binding interfaces
** is a destructor used to dispose of the BLOB or ** is a destructor used to dispose of the BLOB or
** string after SQLite has finished with it. ^The destructor is called ** string after SQLite has finished with it. ^The destructor is called
** to dispose of the BLOB or string even if the call to bind API fails. ** to dispose of the BLOB or string even if the call to the bind API fails,
** except the destructor is not called if the third parameter is a NULL
** pointer or the fourth parameter is negative.
** ^If the fifth argument is ** ^If the fifth argument is
** the special value [SQLITE_STATIC], then SQLite assumes that the ** the special value [SQLITE_STATIC], then SQLite assumes that the
** information is in static, unmanaged space and does not need to be freed. ** information is in static, unmanaged space and does not need to be freed.
@@ -4921,6 +4979,8 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** <tr><td><b>sqlite3_value_nochange&nbsp;&nbsp;</b> ** <tr><td><b>sqlite3_value_nochange&nbsp;&nbsp;</b>
** <td>&rarr;&nbsp;&nbsp;<td>True if the column is unchanged in an UPDATE ** <td>&rarr;&nbsp;&nbsp;<td>True if the column is unchanged in an UPDATE
** against a virtual table. ** against a virtual table.
** <tr><td><b>sqlite3_value_frombind&nbsp;&nbsp;</b>
** <td>&rarr;&nbsp;&nbsp;<td>True if value originated from a [bound parameter]
** </table></blockquote> ** </table></blockquote>
** **
** <b>Details:</b> ** <b>Details:</b>
@@ -4982,6 +5042,11 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** than within an [xUpdate] method call for an UPDATE statement, then ** than within an [xUpdate] method call for an UPDATE statement, then
** the return value is arbitrary and meaningless. ** the return value is arbitrary and meaningless.
** **
** ^The sqlite3_value_frombind(X) interface returns non-zero if the
** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()]
** interfaces. ^If X comes from an SQL literal value, or a table column,
** and expression, then sqlite3_value_frombind(X) returns zero.
**
** Please pay particular attention to the fact that the pointer returned ** Please pay particular attention to the fact that the pointer returned
** from [sqlite3_value_blob()], [sqlite3_value_text()], or ** from [sqlite3_value_blob()], [sqlite3_value_text()], or
** [sqlite3_value_text16()] can be invalidated by a subsequent call to ** [sqlite3_value_text16()] can be invalidated by a subsequent call to
@@ -5027,6 +5092,7 @@ SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
SQLITE_API int sqlite3_value_type(sqlite3_value*); SQLITE_API int sqlite3_value_type(sqlite3_value*);
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
SQLITE_API int sqlite3_value_nochange(sqlite3_value*); SQLITE_API int sqlite3_value_nochange(sqlite3_value*);
SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
/* /*
** CAPI3REF: Finding The Subtype Of SQL Values ** CAPI3REF: Finding The Subtype Of SQL Values
@@ -5762,7 +5828,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
** associated with database N of connection D. ^The main database file ** associated with database N of connection D. ^The main database file
** has the name "main". If there is no attached database N on the database ** has the name "main". If there is no attached database N on the database
** connection D, or if database N is a temporary or in-memory database, then ** connection D, or if database N is a temporary or in-memory database, then
** a NULL pointer is returned. ** this function will return either a NULL pointer or an empty string.
** **
** ^The filename returned by this function is the output of the ** ^The filename returned by this function is the output of the
** xFullPathname method of the [VFS]. ^In other words, the filename ** xFullPathname method of the [VFS]. ^In other words, the filename
@@ -9996,7 +10062,7 @@ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
** sqlite3changeset_next() is called on the iterator or until the ** sqlite3changeset_next() is called on the iterator or until the
** conflict-handler function returns. If pnCol is not NULL, then *pnCol is ** conflict-handler function returns. If pnCol is not NULL, then *pnCol is
** set to the number of columns in the table affected by the change. If ** set to the number of columns in the table affected by the change. If
** pbIncorrect is not NULL, then *pbIndirect is set to true (1) if the change ** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
** is an indirect change, or false (0) otherwise. See the documentation for ** is an indirect change, or false (0) otherwise. See the documentation for
** [sqlite3session_indirect()] for a description of direct and indirect ** [sqlite3session_indirect()] for a description of direct and indirect
** changes. Finally, if pOp is not NULL, then *pOp is set to one of ** changes. Finally, if pOp is not NULL, then *pOp is set to one of
@@ -10863,7 +10929,7 @@ SQLITE_API int sqlite3rebaser_configure(
** in size. This function allocates and populates a buffer with a copy ** in size. This function allocates and populates a buffer with a copy
** of the changeset rebased rebased according to the configuration of the ** of the changeset rebased rebased according to the configuration of the
** rebaser object passed as the first argument. If successful, (*ppOut) ** rebaser object passed as the first argument. If successful, (*ppOut)
** is set to point to the new buffer containing the rebased changset and ** is set to point to the new buffer containing the rebased changeset and
** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the ** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the
** responsibility of the caller to eventually free the new buffer using ** responsibility of the caller to eventually free the new buffer using
** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) ** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut)
@@ -11230,12 +11296,8 @@ struct Fts5PhraseIter {
** **
** Usually, output parameter *piPhrase is set to the phrase number, *piCol ** Usually, output parameter *piPhrase is set to the phrase number, *piCol
** to the column in which it occurs and *piOff the token offset of the ** to the column in which it occurs and *piOff the token offset of the
** first token of the phrase. The exception is if the table was created ** first token of the phrase. Returns SQLITE_OK if successful, or an error
** with the offsets=0 option specified. In this case *piOff is always ** code (i.e. SQLITE_NOMEM) if an error occurs.
** set to -1.
**
** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM)
** if an error occurs.
** **
** This API can be quite slow if used with an FTS5 table created with the ** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option. ** "detail=none" or "detail=column" option.
@@ -11276,7 +11338,7 @@ struct Fts5PhraseIter {
** Save the pointer passed as the second argument as the extension functions ** Save the pointer passed as the second argument as the extension functions
** "auxiliary data". The pointer may then be retrieved by the current or any ** "auxiliary data". The pointer may then be retrieved by the current or any
** future invocation of the same fts5 extension function made as part of ** future invocation of the same fts5 extension function made as part of
** of the same MATCH query using the xGetAuxdata() API. ** the same MATCH query using the xGetAuxdata() API.
** **
** Each extension function is allocated a single auxiliary data slot for ** Each extension function is allocated a single auxiliary data slot for
** each FTS query (MATCH expression). If the extension function is invoked ** each FTS query (MATCH expression). If the extension function is invoked
@@ -11291,7 +11353,7 @@ struct Fts5PhraseIter {
** The xDelete callback, if one is specified, is also invoked on the ** The xDelete callback, if one is specified, is also invoked on the
** auxiliary data pointer after the FTS5 query has finished. ** auxiliary data pointer after the FTS5 query has finished.
** **
** If an error (e.g. an OOM condition) occurs within this function, an ** If an error (e.g. an OOM condition) occurs within this function,
** the auxiliary data is set to NULL and an error code returned. If the ** the auxiliary data is set to NULL and an error code returned. If the
** xDelete parameter was not NULL, it is invoked on the auxiliary data ** xDelete parameter was not NULL, it is invoked on the auxiliary data
** pointer before returning. ** pointer before returning.
@@ -11524,11 +11586,11 @@ struct Fts5ExtensionApi {
** the tokenizer substitutes "first" for "1st" and the query works ** the tokenizer substitutes "first" for "1st" and the query works
** as expected. ** as expected.
** **
** <li> By adding multiple synonyms for a single term to the FTS index. ** <li> By querying the index for all synonyms of each query term
** In this case, when tokenizing query text, the tokenizer may ** separately. In this case, when tokenizing query text, the
** provide multiple synonyms for a single term within the document. ** tokenizer may provide multiple synonyms for a single term
** FTS5 then queries the index for each synonym individually. For ** within the document. FTS5 then queries the index for each
** example, faced with the query: ** synonym individually. For example, faced with the query:
** **
** <codeblock> ** <codeblock>
** ... MATCH 'first place'</codeblock> ** ... MATCH 'first place'</codeblock>
@@ -11552,7 +11614,7 @@ struct Fts5ExtensionApi {
** "place". ** "place".
** **
** This way, even if the tokenizer does not provide synonyms ** This way, even if the tokenizer does not provide synonyms
** when tokenizing query text (it should not - to do would be ** when tokenizing query text (it should not - to do so would be
** inefficient), it doesn't matter if the user queries for ** inefficient), it doesn't matter if the user queries for
** 'first + place' or '1st + place', as there are entries in the ** 'first + place' or '1st + place', as there are entries in the
** FTS index corresponding to both forms of the first token. ** FTS index corresponding to both forms of the first token.

View File

@@ -319,6 +319,9 @@ struct sqlite3_api_routines {
void(*xDestroy)(void*)); void(*xDestroy)(void*));
/* Version 3.26.0 and later */ /* Version 3.26.0 and later */
const char *(*normalized_sql)(sqlite3_stmt*); const char *(*normalized_sql)(sqlite3_stmt*);
/* Version 3.28.0 and later */
int (*stmt_isexplain)(sqlite3_stmt*);
int (*value_frombind)(sqlite3_value*);
}; };
/* /*
@@ -608,6 +611,9 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_create_window_function sqlite3_api->create_window_function #define sqlite3_create_window_function sqlite3_api->create_window_function
/* Version 3.26.0 and later */ /* Version 3.26.0 and later */
#define sqlite3_normalized_sql sqlite3_api->normalized_sql #define sqlite3_normalized_sql sqlite3_api->normalized_sql
/* Version 3.28.0 and later */
#define sqlite3_stmt_isexplain sqlite3_api->isexplain
#define sqlite3_value_frombind sqlite3_api->frombind
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)

View File

@@ -113,7 +113,6 @@ add_qtc_library(ClangSupport
requestcompletionsmessage.cpp requestcompletionsmessage.h requestcompletionsmessage.cpp requestcompletionsmessage.h
requestfollowsymbolmessage.cpp requestfollowsymbolmessage.h requestfollowsymbolmessage.cpp requestfollowsymbolmessage.h
requestreferencesmessage.cpp requestreferencesmessage.h requestreferencesmessage.cpp requestreferencesmessage.h
requestsourcelocationforrenamingmessage.cpp requestsourcelocationforrenamingmessage.h
requestsourcerangesanddiagnosticsforquerymessage.cpp requestsourcerangesanddiagnosticsforquerymessage.h requestsourcerangesanddiagnosticsforquerymessage.cpp requestsourcerangesanddiagnosticsforquerymessage.h
requestsourcerangesforquerymessage.cpp requestsourcerangesforquerymessage.h requestsourcerangesforquerymessage.cpp requestsourcerangesforquerymessage.h
requesttooltipmessage.cpp requesttooltipmessage.h requesttooltipmessage.cpp requesttooltipmessage.h
@@ -121,7 +120,6 @@ add_qtc_library(ClangSupport
sourcelocationcontainer.cpp sourcelocationcontainer.h sourcelocationcontainer.cpp sourcelocationcontainer.h
sourcelocationcontainerv2.cpp sourcelocationcontainerv2.h sourcelocationcontainerv2.cpp sourcelocationcontainerv2.h
sourcelocationscontainer.cpp sourcelocationscontainer.h sourcelocationscontainer.cpp sourcelocationscontainer.h
sourcelocationsforrenamingmessage.cpp sourcelocationsforrenamingmessage.h
sourcerangecontainer.cpp sourcerangecontainer.h sourcerangecontainer.cpp sourcerangecontainer.h
sourcerangecontainerv2.cpp sourcerangecontainerv2.h sourcerangecontainerv2.cpp sourcerangecontainerv2.h
sourcerangesanddiagnosticsforquerymessage.cpp sourcerangesanddiagnosticsforquerymessage.h sourcerangesanddiagnosticsforquerymessage.cpp sourcerangesanddiagnosticsforquerymessage.h

View File

@@ -38,7 +38,6 @@ QDebug operator<<(QDebug debug, const RequestCompletionsMessage &message)
debug.nospace() << message.filePath << ", "; debug.nospace() << message.filePath << ", ";
debug.nospace() << message.line << ", "; debug.nospace() << message.line << ", ";
debug.nospace() << message.column << ", "; debug.nospace() << message.column << ", ";
debug.nospace() << message.projectPartId << ", ";
debug.nospace() << message.ticketNumber; debug.nospace() << message.ticketNumber;
debug.nospace() << message.funcNameStartLine << ", "; debug.nospace() << message.funcNameStartLine << ", ";
debug.nospace() << message.funcNameStartColumn << ", "; debug.nospace() << message.funcNameStartColumn << ", ";

View File

@@ -88,7 +88,6 @@ public:
public: public:
Utf8String filePath; Utf8String filePath;
Utf8String projectPartId;
static CLANGSUPPORT_EXPORT quint64 ticketCounter; static CLANGSUPPORT_EXPORT quint64 ticketCounter;
quint64 ticketNumber = 0; quint64 ticketNumber = 0;
quint32 line = 0; quint32 line = 0;

View File

@@ -130,6 +130,7 @@ void QmlDebugConnectionManager::startLocalServer()
if (!m_connection || ++(m_numRetries) >= m_maximumRetries) { if (!m_connection || ++(m_numRetries) >= m_maximumRetries) {
stopConnectionTimer(); stopConnectionTimer();
destroyConnection();
emit connectionFailed(); emit connectionFailed();
} }
}); });
@@ -145,10 +146,10 @@ void QmlDebugConnectionManager::startLocalServer()
void QmlDebugConnectionManager::retryConnect() void QmlDebugConnectionManager::retryConnect()
{ {
destroyConnection();
if (m_server.scheme() == Utils::urlSocketScheme()) { if (m_server.scheme() == Utils::urlSocketScheme()) {
startLocalServer(); startLocalServer();
} else if (m_server.scheme() == Utils::urlTcpScheme()) { } else if (m_server.scheme() == Utils::urlTcpScheme()) {
destroyConnection();
connectToTcpServer(); connectToTcpServer();
} else { } else {
emit connectionFailed(); emit connectionFailed();

View File

@@ -92,7 +92,7 @@ SimpleReaderNode::Ptr SimpleReaderNode::create(const QString &name, WeakPtr pare
Ptr newNode(new SimpleReaderNode(name, parent)); Ptr newNode(new SimpleReaderNode(name, parent));
newNode->m_weakThis = newNode; newNode->m_weakThis = newNode;
if (parent) if (parent)
parent.data()->m_children.append(newNode); parent.toStrongRef().data()->m_children.append(newNode);
return newNode; return newNode;
} }
@@ -323,21 +323,21 @@ void SimpleReader::elementEnd()
{ {
Q_ASSERT(m_currentNode); Q_ASSERT(m_currentNode);
qCDebug(simpleReaderLog) << "elementEnd()" << m_currentNode.data()->name(); qCDebug(simpleReaderLog) << "elementEnd()" << m_currentNode.toStrongRef().data()->name();
m_currentNode = m_currentNode.data()->parent(); m_currentNode = m_currentNode.toStrongRef().data()->parent();
} }
void SimpleReader::propertyDefinition(const QString &name, const QVariant &value) void SimpleReader::propertyDefinition(const QString &name, const QVariant &value)
{ {
Q_ASSERT(m_currentNode); Q_ASSERT(m_currentNode);
qCDebug(simpleReaderLog) << "propertyDefinition()" << m_currentNode.data()->name() << name << value; qCDebug(simpleReaderLog) << "propertyDefinition()" << m_currentNode.toStrongRef().data()->name() << name << value;
if (m_currentNode.data()->propertyNames().contains(name)) if (m_currentNode.toStrongRef().data()->propertyNames().contains(name))
addError(tr("Property is defined twice."), currentSourceLocation()); addError(tr("Property is defined twice."), currentSourceLocation());
m_currentNode.data()->setProperty(name, value); m_currentNode.toStrongRef().data()->setProperty(name, value);
} }
} // namespace QmlJS } // namespace QmlJS

View File

@@ -25,10 +25,10 @@
#include "sqlitedatabasebackend.h" #include "sqlitedatabasebackend.h"
#include "sqlitebasestatement.h"
#include "sqliteexception.h" #include "sqliteexception.h"
#include "sqlitereadstatement.h" #include "sqlitereadstatement.h"
#include "sqlitereadwritestatement.h" #include "sqlitereadwritestatement.h"
#include "sqlitebasestatement.h"
#include "sqlitewritestatement.h" #include "sqlitewritestatement.h"
#include <QFileInfo> #include <QFileInfo>
@@ -177,8 +177,12 @@ void DatabaseBackend::setLastInsertedRowId(int64_t rowId)
void DatabaseBackend::execute(Utils::SmallStringView sqlStatement) void DatabaseBackend::execute(Utils::SmallStringView sqlStatement)
{ {
ReadWriteStatement statement(sqlStatement, m_database); try {
statement.execute(); ReadWriteStatement statement(sqlStatement, m_database);
statement.execute();
} catch (StatementIsBusy &) {
execute(sqlStatement);
}
} }
void DatabaseBackend::close() void DatabaseBackend::close()
@@ -217,14 +221,14 @@ void DatabaseBackend::registerBusyHandler()
void DatabaseBackend::registerRankingFunction() void DatabaseBackend::registerRankingFunction()
{ {
sqlite3_create_function_v2(sqliteDatabaseHandle(), "okapi_bm25", -1, SQLITE_ANY, 0, okapi_bm25, 0, 0, 0); // sqlite3_create_function_v2(sqliteDatabaseHandle(), "okapi_bm25", -1, SQLITE_ANY, 0, okapi_bm25, 0, 0, 0);
sqlite3_create_function_v2(sqliteDatabaseHandle(), "okapi_bm25f", -1, SQLITE_UTF8, 0, okapi_bm25f, 0, 0, 0); // sqlite3_create_function_v2(sqliteDatabaseHandle(), "okapi_bm25f", -1, SQLITE_UTF8, 0, okapi_bm25f, 0, 0, 0);
sqlite3_create_function_v2(sqliteDatabaseHandle(), "okapi_bm25f_kb", -1, SQLITE_UTF8, 0, okapi_bm25f_kb, 0, 0, 0); // sqlite3_create_function_v2(sqliteDatabaseHandle(), "okapi_bm25f_kb", -1, SQLITE_UTF8, 0, okapi_bm25f_kb, 0, 0, 0);
} }
int DatabaseBackend::busyHandlerCallback(void *, int counter) int DatabaseBackend::busyHandlerCallback(void *, int counter)
{ {
Q_UNUSED(counter); Q_UNUSED(counter)
#ifdef QT_DEBUG #ifdef QT_DEBUG
//qWarning() << "Busy handler invoked" << counter << "times!"; //qWarning() << "Busy handler invoked" << counter << "times!";
#endif #endif
@@ -453,11 +457,15 @@ void DatabaseBackend::throwDatabaseIsNotOpen(const char *whatHasHappens) const
template <typename Type> template <typename Type>
Type DatabaseBackend::toValue(Utils::SmallStringView sqlStatement) Type DatabaseBackend::toValue(Utils::SmallStringView sqlStatement)
{ {
ReadWriteStatement statement(sqlStatement, m_database); try {
ReadWriteStatement statement(sqlStatement, m_database);
statement.next(); statement.next();
return statement.fetchValue<Type>(0); return statement.fetchValue<Type>(0);
} catch (StatementIsBusy &) {
return toValue<Type>(sqlStatement);
}
} }
} // namespace Sqlite } // namespace Sqlite

View File

@@ -158,7 +158,6 @@ add_qtc_library(Utils
textutils.cpp textutils.h textutils.cpp textutils.h
theme/theme.cpp theme/theme.h theme/theme_p.h theme/theme.cpp theme/theme.h theme/theme_p.h
tooltip/effects.h tooltip/effects.h
tooltip/reuse.h
tooltip/tips.cpp tooltip/tips.h tooltip/tips.cpp tooltip/tips.h
tooltip/tooltip.cpp tooltip/tooltip.h tooltip/tooltip.cpp tooltip/tooltip.h
touchbar/touchbar.h touchbar/touchbar.h

View File

@@ -1,55 +0,0 @@
/****************************************************************************
**
** 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 <utils/hostosinfo.h>
#include <QPoint>
#include <QRect>
#include <QWidget>
#include <QApplication>
#include <QDesktopWidget>
namespace Utils {
namespace Internal {
inline int screenNumber(const QPoint &pos, QWidget *w)
{
if (QApplication::desktop()->isVirtualDesktop())
return QApplication::desktop()->screenNumber(pos);
else
return QApplication::desktop()->screenNumber(w);
}
inline QRect screenGeometry(const QPoint &pos, QWidget *w)
{
if (HostOsInfo::isMacHost())
return QApplication::desktop()->availableGeometry(screenNumber(pos, w));
return QApplication::desktop()->screenGeometry(screenNumber(pos, w));
}
} // namespace Internal
} // namespace Utils

View File

@@ -25,8 +25,8 @@
#include "tips.h" #include "tips.h"
#include "tooltip.h" #include "tooltip.h"
#include "reuse.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QRect> #include <QRect>
@@ -43,6 +43,12 @@
#include <QPaintEvent> #include <QPaintEvent>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QPoint>
#include <QRect>
#include <QWidget>
#include <QApplication>
#include <QDesktopWidget>
#include <memory> #include <memory>
namespace Utils { namespace Utils {
@@ -287,5 +293,21 @@ bool WidgetTip::equals(int typeId, const QVariant &other, const QVariant &otherC
&& other.value<QWidget *>() == m_widget; && other.value<QWidget *>() == m_widget;
} }
int screenNumber(const QPoint &pos, QWidget *w)
{
if (QApplication::desktop()->isVirtualDesktop())
return QApplication::desktop()->screenNumber(pos);
else
return QApplication::desktop()->screenNumber(w);
}
QRect screenGeometry(const QPoint &pos, QWidget *w)
{
if (HostOsInfo::isMacHost())
return QApplication::desktop()->availableGeometry(screenNumber(pos, w));
return QApplication::desktop()->screenGeometry(screenNumber(pos, w));
}
} // namespace Internal } // namespace Internal
} // namespace Utils } // namespace Utils

View File

@@ -36,6 +36,9 @@
namespace Utils { namespace Utils {
namespace Internal { namespace Internal {
int screenNumber(const QPoint &pos, QWidget *w);
QRect screenGeometry(const QPoint &pos, QWidget *w);
class TipLabel : public QLabel class TipLabel : public QLabel
{ {
public: public:

View File

@@ -26,21 +26,19 @@
#include "tooltip.h" #include "tooltip.h"
#include "tips.h" #include "tips.h"
#include "effects.h" #include "effects.h"
#include "reuse.h"
#include <utils/faketooltip.h> #include <utils/faketooltip.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QString> #include <QApplication>
#include <QColor> #include <QColor>
#include <QGuiApplication> #include <QDebug>
#include <QDesktopWidget>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
#include <QWidget> #include <QWidget>
#include <QMenu>
#include <QDebug>
using namespace Utils; using namespace Utils;
using namespace Internal; using namespace Internal;
@@ -356,6 +354,7 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event)
!m_rect.contains(static_cast<QMouseEvent*>(event)->pos())) { !m_rect.contains(static_cast<QMouseEvent*>(event)->pos())) {
hideTipWithDelay(); hideTipWithDelay();
} }
break;
default: default:
break; break;
} }

View File

@@ -223,7 +223,6 @@ HEADERS += \
$$PWD/elidinglabel.h \ $$PWD/elidinglabel.h \
$$PWD/tooltip/tooltip.h \ $$PWD/tooltip/tooltip.h \
$$PWD/tooltip/tips.h \ $$PWD/tooltip/tips.h \
$$PWD/tooltip/reuse.h \
$$PWD/tooltip/effects.h \ $$PWD/tooltip/effects.h \
$$PWD/unixutils.h \ $$PWD/unixutils.h \
$$PWD/ansiescapecodehandler.h \ $$PWD/ansiescapecodehandler.h \

View File

@@ -305,7 +305,6 @@ Project {
prefix: "tooltip/" prefix: "tooltip/"
files: [ files: [
"effects.h", "effects.h",
"reuse.h",
"tips.cpp", "tips.cpp",
"tips.h", "tips.h",
"tooltip.cpp", "tooltip.cpp",

View File

@@ -110,7 +110,7 @@ void TestCodeParser::setState(State state)
m_partialUpdatePostponed = false; m_partialUpdatePostponed = false;
qCDebug(LOG) << "calling scanForTests with postponed files (setState)"; qCDebug(LOG) << "calling scanForTests with postponed files (setState)";
if (!m_reparseTimer.isActive()) if (!m_reparseTimer.isActive())
scanForTests(m_postponedFiles.toList()); scanForTests(Utils::toList(m_postponedFiles));
} }
} }
} }
@@ -469,7 +469,7 @@ void TestCodeParser::onPartialParsingFinished()
m_partialUpdatePostponed = false; m_partialUpdatePostponed = false;
qCDebug(LOG) << "calling scanForTests with postponed files (onPartialParsingFinished)"; qCDebug(LOG) << "calling scanForTests with postponed files (onPartialParsingFinished)";
if (!m_reparseTimer.isActive()) if (!m_reparseTimer.isActive())
scanForTests(m_postponedFiles.toList()); scanForTests(Utils::toList(m_postponedFiles));
} else { } else {
m_dirty |= m_codeModelParsing; m_dirty |= m_codeModelParsing;
if (m_dirty) { if (m_dirty) {
@@ -491,7 +491,7 @@ void TestCodeParser::onPartialParsingFinished()
void TestCodeParser::parsePostponedFiles() void TestCodeParser::parsePostponedFiles()
{ {
m_reparseTimerTimedOut = true; m_reparseTimerTimedOut = true;
scanForTests(m_postponedFiles.toList()); scanForTests(Utils::toList(m_postponedFiles));
} }
void TestCodeParser::releaseParserInternals() void TestCodeParser::releaseParserInternals()

View File

@@ -176,10 +176,13 @@ void TestRunner::scheduleNext()
tr("Executable path is empty. (%1)").arg(m_currentConfig->displayName())); tr("Executable path is empty. (%1)").arg(m_currentConfig->displayName()));
delete m_currentConfig; delete m_currentConfig;
m_currentConfig = nullptr; m_currentConfig = nullptr;
if (m_selectedTests.isEmpty()) if (m_selectedTests.isEmpty()) {
if (m_fakeFutureInterface)
m_fakeFutureInterface->reportFinished();
onFinished(); onFinished();
else } else {
onProcessFinished(); onProcessFinished();
}
return; return;
} }
if (!m_currentConfig->project()) if (!m_currentConfig->project())

View File

@@ -168,6 +168,7 @@ void ClangCompletionContextAnalyzer::handleFunctionCall(int afterOperatorPositio
} else { } else {
const int functionNameStart = startOfFunctionCall(afterOperatorPosition); const int functionNameStart = startOfFunctionCall(afterOperatorPosition);
if (functionNameStart >= 0) { if (functionNameStart >= 0) {
m_addSnippets = functionNameStart == afterOperatorPosition;
// Always pass the position right after '(' to libclang because // Always pass the position right after '(' to libclang because
// positions after the comma might be problematic if a preceding // positions after the comma might be problematic if a preceding
// argument is invalid code. // argument is invalid code.

View File

@@ -50,6 +50,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDebug> #include <QDebug>
#include <QElapsedTimer>
#include <QFileInfo> #include <QFileInfo>
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QSharedPointer> #include <QSharedPointer>
@@ -302,7 +303,7 @@ WaitForUpdatedCodeWarnings::WaitForUpdatedCodeWarnings(ClangEditorDocumentProces
bool WaitForUpdatedCodeWarnings::wait(int timeOutInMs) const bool WaitForUpdatedCodeWarnings::wait(int timeOutInMs) const
{ {
QTime time; QElapsedTimer time;
time.start(); time.start();
forever { forever {
@@ -580,7 +581,7 @@ bool ProcessEventsCommand::run()
{ {
qCDebug(debug) << "line" << context().lineNumber << "ProcessEventsCommand" << m_durationInMs; qCDebug(debug) << "line" << context().lineNumber << "ProcessEventsCommand" << m_durationInMs;
QTime time; QElapsedTimer time;
time.start(); time.start();
forever { forever {

View File

@@ -226,7 +226,7 @@ bool OpenEditorAtCursorPosition::waitUntilProjectPartChanged(const QString &newP
bool OpenEditorAtCursorPosition::waitUntil(const std::function<bool ()> &condition, int timeout) bool OpenEditorAtCursorPosition::waitUntil(const std::function<bool ()> &condition, int timeout)
{ {
QTime time; QElapsedTimer time;
time.start(); time.start();
forever { forever {
@@ -432,7 +432,7 @@ bool MonitorGeneratedUiFile::waitUntilGenerated(int timeout) const
if (m_isGenerated) if (m_isGenerated)
return true; return true;
QTime time; QElapsedTimer time;
time.start(); time.start();
forever { forever {
@@ -472,10 +472,10 @@ public:
{ {
QTC_ASSERT(writeFile(m_filePath, m_fileContents), return false); QTC_ASSERT(writeFile(m_filePath, m_fileContents), return false);
QTime totalTime; QElapsedTimer totalTime;
totalTime.start(); totalTime.start();
QTime writeFileAgainTime; QElapsedTimer writeFileAgainTime;
writeFileAgainTime.start(); writeFileAgainTime.start();
forever { forever {

View File

@@ -6,11 +6,6 @@ include(../../shared/clang/clang_defines.pri)
requires(!isEmpty(CLANGFORMAT_LIBS)) requires(!isEmpty(CLANGFORMAT_LIBS))
win32 {
LLVM_BUILDMODE = $$system($$llvm_config --build-mode, lines)
CONFIG(debug, debug|release):requires(equals(LLVM_BUILDMODE, "Debug"))
}
LIBS += $$CLANGFORMAT_LIBS LIBS += $$CLANGFORMAT_LIBS
INCLUDEPATH += $$LLVM_INCLUDEPATH INCLUDEPATH += $$LLVM_INCLUDEPATH

View File

@@ -197,13 +197,13 @@ static QString configForFile(Utils::FilePath fileName, bool checkForSettings)
{ {
QDir overrideDir; QDir overrideDir;
if (!checkForSettings || useProjectOverriddenSettings()) { if (!checkForSettings || useProjectOverriddenSettings()) {
overrideDir = projectPath().toString(); overrideDir.setPath(projectPath().toString());
if (!overrideDir.isEmpty() && overrideDir.exists(Constants::SETTINGS_FILE_NAME)) if (!overrideDir.isEmpty() && overrideDir.exists(Constants::SETTINGS_FILE_NAME))
return overrideDir.filePath(Constants::SETTINGS_FILE_NAME); return overrideDir.filePath(Constants::SETTINGS_FILE_NAME);
} }
if (!checkForSettings || useGlobalOverriddenSettings()) { if (!checkForSettings || useGlobalOverriddenSettings()) {
overrideDir = globalPath().toString(); overrideDir.setPath(globalPath().toString());
if (!overrideDir.isEmpty() && overrideDir.exists(Constants::SETTINGS_FILE_NAME)) if (!overrideDir.isEmpty() && overrideDir.exists(Constants::SETTINGS_FILE_NAME))
return overrideDir.filePath(Constants::SETTINGS_FILE_NAME); return overrideDir.filePath(Constants::SETTINGS_FILE_NAME);
} }

View File

@@ -6,11 +6,6 @@ include(../../shared/clang/clang_defines.pri)
requires(!isEmpty(LIBTOOLING_LIBS)) requires(!isEmpty(LIBTOOLING_LIBS))
win32 {
LLVM_BUILDMODE = $$system($$llvm_config --build-mode, lines)
CONFIG(debug, debug|release):requires(equals(LLVM_BUILDMODE, "Debug"))
}
HEADERS += \ HEADERS += \
clangrefactoringplugin.h \ clangrefactoringplugin.h \
baseclangquerytexteditorwidget.h \ baseclangquerytexteditorwidget.h \

View File

@@ -464,11 +464,11 @@ void ClangTidyClazyTool::handleStateUpdate()
} }
QList<Diagnostic> ClangTidyClazyTool::read(const QString &filePath, QList<Diagnostic> ClangTidyClazyTool::read(const QString &filePath,
const Utils::FilePath &projectRootDir, const QSet<Utils::FilePath> &projectFiles,
const QString &logFilePath, const QString &logFilePath,
QString *errorMessage) const QString *errorMessage) const
{ {
return readSerializedDiagnostics(filePath, projectRootDir, logFilePath, errorMessage); return readSerializedDiagnostics(filePath, projectFiles, logFilePath, errorMessage);
} }
void ClangTidyClazyTool::onNewDiagnosticsAvailable(const QList<Diagnostic> &diagnostics) void ClangTidyClazyTool::onNewDiagnosticsAvailable(const QList<Diagnostic> &diagnostics)

View File

@@ -54,7 +54,7 @@ public:
void startTool(bool askUserForFileSelection) final; void startTool(bool askUserForFileSelection) final;
QList<Diagnostic> read(const QString &filePath, QList<Diagnostic> read(const QString &filePath,
const Utils::FilePath &projectRootDir, const QSet<Utils::FilePath> &projectFiles,
const QString &logFilePath, const QString &logFilePath,
QString *errorMessage) const final; QString *errorMessage) const final;

View File

@@ -50,7 +50,7 @@ public:
virtual void startTool(bool askUserForFileSelection) = 0; virtual void startTool(bool askUserForFileSelection) = 0;
virtual QList<Diagnostic> read(const QString &filePath, virtual QList<Diagnostic> read(const QString &filePath,
const Utils::FilePath &projectRootDir, const QSet<Utils::FilePath> &projectFiles,
const QString &logFilePath, const QString &logFilePath,
QString *errorMessage) const = 0; QString *errorMessage) const = 0;

View File

@@ -289,6 +289,7 @@ void ClangToolRunControl::start()
} }
m_projectInfo = CppTools::CppModelManager::instance()->projectInfo(m_target->project()); m_projectInfo = CppTools::CppModelManager::instance()->projectInfo(m_target->project());
m_projectFiles = Utils::toSet(m_target->project()->files(Project::AllFiles));
// Some projects provides CompilerCallData once a build is finished, // Some projects provides CompilerCallData once a build is finished,
if (m_projectInfo.configurationOrFilesChanged(m_projectInfoBeforeBuild)) { if (m_projectInfo.configurationOrFilesChanged(m_projectInfoBeforeBuild)) {
@@ -361,6 +362,7 @@ void ClangToolRunControl::stop()
QObject::disconnect(runner, nullptr, this, nullptr); QObject::disconnect(runner, nullptr, this, nullptr);
delete runner; delete runner;
} }
m_projectFiles.clear();
m_runners.clear(); m_runners.clear();
m_unitsToProcess.clear(); m_unitsToProcess.clear();
m_progress.reportFinished(); m_progress.reportFinished();
@@ -390,22 +392,14 @@ void ClangToolRunControl::analyzeNextFile()
Utils::StdOutFormat); Utils::StdOutFormat);
} }
static Utils::FilePath cleanPath(const Utils::FilePath &filePath)
{
return Utils::FilePath::fromString(QDir::cleanPath(filePath.toString()));
}
void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath) void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath)
{ {
const QString logFilePath = qobject_cast<ClangToolRunner *>(sender())->logFilePath(); const QString logFilePath = qobject_cast<ClangToolRunner *>(sender())->logFilePath();
qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath; qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath;
QTC_ASSERT(m_projectInfo.project(), return);
const Utils::FilePath projectRootDir = cleanPath(m_projectInfo.project()->projectDirectory());
QString errorMessage; QString errorMessage;
const QList<Diagnostic> diagnostics = tool()->read(filePath, const QList<Diagnostic> diagnostics = tool()->read(filePath,
projectRootDir, m_projectFiles,
logFilePath, logFilePath,
&errorMessage); &errorMessage);
QFile::remove(logFilePath); // Clean-up. QFile::remove(logFilePath); // Clean-up.

View File

@@ -104,6 +104,7 @@ private:
QFutureInterface<void> m_progress; QFutureInterface<void> m_progress;
AnalyzeUnits m_unitsToProcess; AnalyzeUnits m_unitsToProcess;
QSet<Utils::FilePath> m_projectFiles;
QSet<ClangToolRunner *> m_runners; QSet<ClangToolRunner *> m_runners;
int m_initialFilesToProcessSize = 0; int m_initialFilesToProcessSize = 0;
int m_filesAnalyzed = 0; int m_filesAnalyzed = 0;

View File

@@ -122,7 +122,7 @@ static ExplainingStep buildFixIt(const CXDiagnostic cxDiagnostic, unsigned index
} }
static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic, static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
const Utils::FilePath &projectRootDir, const QSet<Utils::FilePath> &projectFiles,
const QString &nativeFilePath) const QString &nativeFilePath)
{ {
Diagnostic diagnostic; Diagnostic diagnostic;
@@ -136,7 +136,7 @@ static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
diagnostic.location = diagLocationFromSourceLocation(cxLocation); diagnostic.location = diagLocationFromSourceLocation(cxLocation);
const auto diagnosticFilePath = Utils::FilePath::fromString(diagnostic.location.filePath); const auto diagnosticFilePath = Utils::FilePath::fromString(diagnostic.location.filePath);
if (!diagnosticFilePath.isChildOf(projectRootDir)) if (!projectFiles.contains(diagnosticFilePath))
return diagnostic; return diagnostic;
// TODO: Introduce CppTools::ProjectFile::isGenerated to filter these out properly // TODO: Introduce CppTools::ProjectFile::isGenerated to filter these out properly
@@ -183,7 +183,7 @@ static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
} }
static QList<Diagnostic> readSerializedDiagnostics_helper(const QString &filePath, static QList<Diagnostic> readSerializedDiagnostics_helper(const QString &filePath,
const Utils::FilePath &projectRootDir, const QSet<Utils::FilePath> &projectFiles,
const QString &logFilePath) const QString &logFilePath)
{ {
QList<Diagnostic> list; QList<Diagnostic> list;
@@ -206,7 +206,7 @@ static QList<Diagnostic> readSerializedDiagnostics_helper(const QString &filePat
Utils::ExecuteOnDestruction cleanUpDiagnostic([&]() { Utils::ExecuteOnDestruction cleanUpDiagnostic([&]() {
clang_disposeDiagnostic(cxDiagnostic); clang_disposeDiagnostic(cxDiagnostic);
}); });
const Diagnostic diagnostic = buildDiagnostic(cxDiagnostic, projectRootDir, nativeFilePath); const Diagnostic diagnostic = buildDiagnostic(cxDiagnostic, projectFiles, nativeFilePath);
if (!diagnostic.isValid()) if (!diagnostic.isValid())
continue; continue;
@@ -232,14 +232,14 @@ static bool checkFilePath(const QString &filePath, QString *errorMessage)
} }
QList<Diagnostic> readSerializedDiagnostics(const QString &filePath, QList<Diagnostic> readSerializedDiagnostics(const QString &filePath,
const Utils::FilePath &projectRootDir, const QSet<Utils::FilePath> &projectFiles,
const QString &logFilePath, const QString &logFilePath,
QString *errorMessage) QString *errorMessage)
{ {
if (!checkFilePath(logFilePath, errorMessage)) if (!checkFilePath(logFilePath, errorMessage))
return QList<Diagnostic>(); return QList<Diagnostic>();
return readSerializedDiagnostics_helper(filePath, projectRootDir, logFilePath); return readSerializedDiagnostics_helper(filePath, projectFiles, logFilePath);
} }
} // namespace Internal } // namespace Internal

View File

@@ -35,7 +35,7 @@ namespace ClangTools {
namespace Internal { namespace Internal {
QList<Diagnostic> readSerializedDiagnostics(const QString &filePath, QList<Diagnostic> readSerializedDiagnostics(const QString &filePath,
const Utils::FilePath &projectRootDir, const QSet<Utils::FilePath> &projectFiles,
const QString &logFilePath, const QString &logFilePath,
QString *errorMessage); QString *errorMessage);

View File

@@ -25,8 +25,9 @@
#include "clangtoolsunittests.h" #include "clangtoolsunittests.h"
#include "clangtoolsdiagnostic.h"
#include "clangtidyclazytool.h" #include "clangtidyclazytool.h"
#include "clangtoolsdiagnostic.h"
#include "clangtoolssettings.h"
#include "clangtoolsutils.h" #include "clangtoolsutils.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -50,6 +51,8 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
Q_DECLARE_METATYPE(CppTools::ClangDiagnosticConfig)
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
@@ -75,16 +78,17 @@ void ClangToolsUnitTests::cleanupTestCase()
delete m_tmpDir; delete m_tmpDir;
} }
static CppTools::ClangDiagnosticConfig createTidyClazyConfig() static CppTools::ClangDiagnosticConfig configFor(const QString &tidyChecks,
const QString &clazyChecks)
{ {
CppTools::ClangDiagnosticConfig config; CppTools::ClangDiagnosticConfig config;
config.setId("Test.ClangTidy"); config.setId("Test.MyTestConfig");
config.setDisplayName("Test"); config.setDisplayName("Test");
config.setIsReadOnly(true); config.setIsReadOnly(true);
config.setClangOptions(QStringList{QStringLiteral("-Wno-everything")}); config.setClangOptions(QStringList{QStringLiteral("-Wno-everything")});
config.setClangTidyMode(CppTools::ClangDiagnosticConfig::TidyMode::ChecksPrefixList); config.setClangTidyMode(CppTools::ClangDiagnosticConfig::TidyMode::ChecksPrefixList);
config.setClangTidyChecks("modernize-*, misc-*"); config.setClangTidyChecks(tidyChecks);
config.setClazyChecks("level2"); config.setClazyChecks(clazyChecks);
return config; return config;
} }
@@ -92,6 +96,7 @@ void ClangToolsUnitTests::testProject()
{ {
QFETCH(QString, projectFilePath); QFETCH(QString, projectFilePath);
QFETCH(int, expectedDiagCount); QFETCH(int, expectedDiagCount);
QFETCH(CppTools::ClangDiagnosticConfig, diagnosticConfig);
if (projectFilePath.contains("mingw")) { if (projectFilePath.contains("mingw")) {
const ToolChain * const toolchain const ToolChain * const toolchain
= ToolChainKitAspect::toolChain(KitManager::kits().constFirst(), = ToolChainKitAspect::toolChain(KitManager::kits().constFirst(),
@@ -106,23 +111,25 @@ void ClangToolsUnitTests::testProject()
ClangTool *tool = ClangTidyClazyTool::instance(); ClangTool *tool = ClangTidyClazyTool::instance();
// Change configs // Change configs
QSharedPointer<CppTools::CppCodeModelSettings> settings = CppTools::codeModelSettings(); QSharedPointer<CppTools::CppCodeModelSettings> cppToolsSettings = CppTools::codeModelSettings();
const CppTools::ClangDiagnosticConfigs originalConfigs = settings->clangCustomDiagnosticConfigs(); ClangToolsSettings *clangToolsSettings = ClangToolsSettings::instance();
const Core::Id originalId = settings->clangDiagnosticConfigId(); const CppTools::ClangDiagnosticConfigs originalConfigs = cppToolsSettings
->clangCustomDiagnosticConfigs();
const Core::Id originalId = clangToolsSettings->diagnosticConfigId();
CppTools::ClangDiagnosticConfigs modifiedConfigs = originalConfigs; CppTools::ClangDiagnosticConfigs modifiedConfigs = originalConfigs;
modifiedConfigs.push_back(diagnosticConfig);
const CppTools::ClangDiagnosticConfig clangTidyConfig = createTidyClazyConfig();
modifiedConfigs.push_back(clangTidyConfig);
ExecuteOnDestruction executeOnDestruction([=]() { ExecuteOnDestruction executeOnDestruction([=]() {
// Restore configs // Restore configs
settings->setClangCustomDiagnosticConfigs(originalConfigs); cppToolsSettings->setClangCustomDiagnosticConfigs(originalConfigs);
settings->setClangDiagnosticConfigId(originalId); clangToolsSettings->setDiagnosticConfigId(originalId);
clangToolsSettings->writeSettings();
}); });
settings->setClangCustomDiagnosticConfigs(modifiedConfigs); cppToolsSettings->setClangCustomDiagnosticConfigs(modifiedConfigs);
settings->setClangDiagnosticConfigId(clangTidyConfig.id()); clangToolsSettings->setDiagnosticConfigId(diagnosticConfig.id());
clangToolsSettings->writeSettings();
tool->startTool(false); tool->startTool(false);
QSignalSpy waiter(tool, SIGNAL(finished(bool))); QSignalSpy waiter(tool, SIGNAL(finished(bool)));
@@ -137,43 +144,50 @@ void ClangToolsUnitTests::testProject_data()
{ {
QTest::addColumn<QString>("projectFilePath"); QTest::addColumn<QString>("projectFilePath");
QTest::addColumn<int>("expectedDiagCount"); QTest::addColumn<int>("expectedDiagCount");
QTest::addColumn<CppTools::ClangDiagnosticConfig>("diagnosticConfig");
// For the simple project, we expect the following warning: // Test simple C++ project.
// warning: use nullptr [modernize-use-nullptr] CppTools::ClangDiagnosticConfig config = configFor("modernize-use-nullptr", QString());
addTestRow("simple/simple.qbs", 1); addTestRow("simple/simple.qbs", 1, config);
addTestRow("simple/simple.pro", 1); addTestRow("simple/simple.pro", 1, config);
addTestRow("simple-library/simple-library.qbs", 0); // Test simple Qt project.
addTestRow("simple-library/simple-library.pro", 0); config = configFor("readability-static-accessed-through-instance", QString());
addTestRow("qt-widgets-app/qt-widgets-app.qbs", 1, config);
addTestRow("qt-widgets-app/qt-widgets-app.pro", 1, config);
addTestRow("stdc++11-includes/stdc++11-includes.qbs", 0); // Test that libraries can be analyzed.
addTestRow("stdc++11-includes/stdc++11-includes.pro", 0); config = configFor(QString(), QString());
addTestRow("simple-library/simple-library.qbs", 0, config);
addTestRow("simple-library/simple-library.pro", 0, config);
// For qt-widgets-app, we expect the following warning for "a.exec()", // Test that standard headers can be parsed.
// "a" being the QApplication object: addTestRow("stdc++11-includes/stdc++11-includes.qbs", 0, config);
// warning: static member accessed through instance addTestRow("stdc++11-includes/stdc++11-includes.pro", 0, config);
// [readability-static-accessed-through-instance]
addTestRow("qt-widgets-app/qt-widgets-app.qbs", 1);
addTestRow("qt-widgets-app/qt-widgets-app.pro", 1);
addTestRow("qt-essential-includes/qt-essential-includes.qbs", 0); // Test that qt essential headers can be parsed.
addTestRow("qt-essential-includes/qt-essential-includes.pro", 0); addTestRow("qt-essential-includes/qt-essential-includes.qbs", 0, config);
addTestRow("qt-essential-includes/qt-essential-includes.pro", 0, config);
addTestRow("mingw-includes/mingw-includes.qbs", 0); // Test that mingw includes can be parsed.
addTestRow("mingw-includes/mingw-includes.pro", 0); addTestRow("mingw-includes/mingw-includes.qbs", 0, config);
addTestRow("mingw-includes/mingw-includes.pro", 0, config);
// Test that tidy and clazy diagnostics are emitted for the same project.
addTestRow("clangtidy_clazy/clangtidy_clazy.pro", addTestRow("clangtidy_clazy/clangtidy_clazy.pro",
4 /* ClangTidy: modernize-*,misc-* */ 1 /*tidy*/ + 1 /*clazy*/,
+ 2 /* Clazy: level1 */); configFor("misc-unconventional-assign-operator", "base-class-event"));
} }
void ClangToolsUnitTests::addTestRow(const QByteArray &relativeFilePath, void ClangToolsUnitTests::addTestRow(const QByteArray &relativeFilePath,
int expectedDiagCount) int expectedDiagCount,
const CppTools::ClangDiagnosticConfig &diagnosticConfig)
{ {
const QString absoluteFilePath = m_tmpDir->absolutePath(relativeFilePath); const QString absoluteFilePath = m_tmpDir->absolutePath(relativeFilePath);
const QString fileName = QFileInfo(absoluteFilePath).fileName(); const QString fileName = QFileInfo(absoluteFilePath).fileName();
QTest::newRow(fileName.toUtf8().constData()) << absoluteFilePath << expectedDiagCount; QTest::newRow(fileName.toUtf8().constData())
<< absoluteFilePath << expectedDiagCount << diagnosticConfig;
} }
} // namespace Internal } // namespace Internal

View File

@@ -27,7 +27,10 @@
#include <QObject> #include <QObject>
namespace CppTools { namespace Tests { class TemporaryCopiedDir; } } namespace CppTools {
class ClangDiagnosticConfig;
namespace Tests { class TemporaryCopiedDir; }
} // namespace CppTools
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
@@ -46,7 +49,9 @@ private slots:
void testProject_data(); void testProject_data();
private: private:
void addTestRow(const QByteArray &relativeFilePath, int expectedDiagCount); void addTestRow(const QByteArray &relativeFilePath,
int expectedDiagCount,
const CppTools::ClangDiagnosticConfig &diagnosticConfig);
private: private:
CppTools::Tests::TemporaryCopiedDir *m_tmpDir = nullptr; CppTools::Tests::TemporaryCopiedDir *m_tmpDir = nullptr;

View File

@@ -40,6 +40,7 @@
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QElapsedTimer>
enum { debug = false }; enum { debug = false };
@@ -267,7 +268,7 @@ void NavigationWidget::onDataUpdate(QSharedPointer<QStandardItem> result)
if (result.isNull()) if (result.isNull())
return; return;
QTime timer; QElapsedTimer timer;
if (debug) if (debug)
timer.start(); timer.start();
// update is received. root item must be updated - and received information // update is received. root item must be updated - and received information

View File

@@ -53,6 +53,7 @@
#include <QReadWriteLock> #include <QReadWriteLock>
#include <QReadLocker> #include <QReadLocker>
#include <QWriteLocker> #include <QWriteLocker>
#include <QElapsedTimer>
enum { debug = false }; enum { debug = false };
@@ -274,7 +275,7 @@ ParserTreeItem::ConstPtr Parser::findItemByRoot(const QStandardItem *item, bool
ParserTreeItem::ConstPtr Parser::parse() ParserTreeItem::ConstPtr Parser::parse()
{ {
QTime time; QElapsedTimer time;
if (debug) if (debug)
time.start(); time.start();

View File

@@ -415,8 +415,7 @@ static QStringList parseDefinition(const QString &definition)
void CMakeTool::parseFunctionDetailsOutput(const QString &output) void CMakeTool::parseFunctionDetailsOutput(const QString &output)
{ {
QSet<QString> functionSet; const QSet<QString> functionSet = Utils::toSet(m_introspection->m_functions);
functionSet.fromList(m_introspection->m_functions);
bool expectDefinition = false; bool expectDefinition = false;
QString currentDefinition; QString currentDefinition;

View File

@@ -275,7 +275,7 @@ std::unique_ptr<CMakeProjectNode> TeaLeafReader::generateProjectTree(
}); });
allIncludePathSet.unite(Utils::toSet(targetIncludePaths)); allIncludePathSet.unite(Utils::toSet(targetIncludePaths));
} }
const QList<FilePath> allIncludePaths = allIncludePathSet.toList(); const QList<FilePath> allIncludePaths = Utils::toList(allIncludePathSet);
const QList<const FileNode *> missingHeaders const QList<const FileNode *> missingHeaders
= Utils::filtered(allFiles, [&allIncludePaths](const FileNode *fn) -> bool { = Utils::filtered(allFiles, [&allIncludePaths](const FileNode *fn) -> bool {

View File

@@ -50,7 +50,7 @@ using namespace Utils;
namespace { namespace {
enum { debug = 0 }; const bool debug = qEnvironmentVariable("QTC_DEBUG_CPPLOCATORFILTERTESTCASE") == "1";
QTC_DECLARE_MYTESTDATADIR("../../../tests/cpplocators/") QTC_DECLARE_MYTESTDATADIR("../../../tests/cpplocators/")

View File

@@ -48,10 +48,10 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
"", "",
{ {
{ {
"android-", "abseil-",
{ {
{ {
"uration-", "duration-",
{ {
"comparison", "comparison",
"division", "division",
@@ -65,18 +65,23 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
"subtraction" "subtraction"
} }
}, },
"aster-strsplit-delimiter", "faster-strsplit-delimiter",
{ {
"o-", "no-",
{ {
"internal-dependencies", "internal-dependencies",
"namespace" "namespace"
} }
}, },
"edundant-strcat-calls", "redundant-strcat-calls",
"tr-cat-append", "str-cat-append",
"tring-find-startswith", "string-find-startswith",
"pgrade-duration-conversions", "upgrade-duration-conversions"
}
},
{
"android-",
{
{ {
"cloexec-", "cloexec-",
{ {
@@ -715,7 +720,12 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
"copy-initialization", "copy-initialization",
"value-param" "value-param"
} }
}, }
}
},
{
"portability-",
{
"simd-intrinsics" "simd-intrinsics"
} }
}, },
@@ -773,8 +783,13 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
}, },
"string-compare", "string-compare",
"uniqueptr-delete-release", "uniqueptr-delete-release",
"uppercase-literal-suffix", "uppercase-literal-suffix"
"rary-objects" }
},
{
"zircon-",
{
"temporary-objects"
} }
} }
} }

View File

@@ -146,7 +146,7 @@ static bool waitForProcessedEditorDocument_internal(CppEditorDocumentHandle *edi
{ {
QTC_ASSERT(editorDocument, return false); QTC_ASSERT(editorDocument, return false);
QTime timer; QElapsedTimer timer;
timer.start(); timer.start();
forever { forever {
@@ -208,7 +208,7 @@ CPlusPlus::Document::Ptr TestCase::waitForFileInGlobalSnapshot(const QString &fi
QList<CPlusPlus::Document::Ptr> TestCase::waitForFilesInGlobalSnapshot(const QStringList &filePaths, QList<CPlusPlus::Document::Ptr> TestCase::waitForFilesInGlobalSnapshot(const QStringList &filePaths,
int timeOutInMs) int timeOutInMs)
{ {
QTime t; QElapsedTimer t;
t.start(); t.start();
QList<CPlusPlus::Document::Ptr> result; QList<CPlusPlus::Document::Ptr> result;
@@ -231,7 +231,7 @@ bool TestCase::waitUntilCppModelManagerIsAwareOf(Project *project, int timeOutIn
if (!project) if (!project)
return false; return false;
QTime t; QElapsedTimer t;
t.start(); t.start();
CppModelManager *modelManager = CppModelManager::instance(); CppModelManager *modelManager = CppModelManager::instance();
@@ -275,7 +275,7 @@ ProjectOpenerAndCloser::~ProjectOpenerAndCloser()
foreach (Project *project, m_openProjects) foreach (Project *project, m_openProjects)
ProjectExplorerPlugin::unloadProject(project); ProjectExplorerPlugin::unloadProject(project);
QTime t; QElapsedTimer t;
t.start(); t.start();
while (!hasGcFinished && t.elapsed() <= 30000) while (!hasGcFinished && t.elapsed() <= 30000)
QCoreApplication::processEvents(); QCoreApplication::processEvents();

View File

@@ -1006,7 +1006,7 @@ Breakpoints BreakHandler::findBreakpointsByIndex(const QList<QModelIndex> &list)
if (Breakpoint bp = findBreakpointByIndex(index)) if (Breakpoint bp = findBreakpointByIndex(index))
items.insert(bp); items.insert(bp);
} }
return items.toList(); return Utils::toList(items);
} }
SubBreakpoints BreakHandler::findSubBreakpointsByIndex(const QList<QModelIndex> &list) const SubBreakpoints BreakHandler::findSubBreakpointsByIndex(const QList<QModelIndex> &list) const
@@ -1016,7 +1016,7 @@ SubBreakpoints BreakHandler::findSubBreakpointsByIndex(const QList<QModelIndex>
if (SubBreakpoint sbp = findSubBreakpointByIndex(index)) if (SubBreakpoint sbp = findSubBreakpointByIndex(index))
items.insert(sbp); items.insert(sbp);
} }
return items.toList(); return Utils::toList(items);
} }

View File

@@ -442,7 +442,7 @@ void DebuggerMainWindow::restorePersistentSettings()
theMainWindow->setAutoHideTitleBars(settings->value(AUTOHIDE_TITLEBARS_KEY, true).toBool()); theMainWindow->setAutoHideTitleBars(settings->value(AUTOHIDE_TITLEBARS_KEY, true).toBool());
theMainWindow->showCentralWidget(settings->value(SHOW_CENTRALWIDGET_KEY, true).toBool()); theMainWindow->showCentralWidget(settings->value(SHOW_CENTRALWIDGET_KEY, true).toBool());
theMainWindow->d->m_persistentChangedDocks theMainWindow->d->m_persistentChangedDocks
= QSet<QString>::fromList(settings->value(CHANGED_DOCK_KEY).toStringList()); = Utils::toSet(settings->value(CHANGED_DOCK_KEY).toStringList());
settings->endGroup(); settings->endGroup();
qCDebug(perspectivesLog) << "LOADED DOCKS:" << theMainWindow->d->m_persistentChangedDocks; qCDebug(perspectivesLog) << "LOADED DOCKS:" << theMainWindow->d->m_persistentChangedDocks;

View File

@@ -320,7 +320,7 @@ QmlEngine::~QmlEngine()
if (textEditPtr) if (textEditPtr)
documentsToClose << textEditPtr.data()->document(); documentsToClose << textEditPtr.data()->document();
} }
EditorManager::closeDocuments(documentsToClose.toList()); EditorManager::closeDocuments(Utils::toList(documentsToClose));
delete d; delete d;
} }

View File

@@ -260,7 +260,8 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
} else { } else {
int index = m_rootContextQueryIds.indexOf(queryId); int index = m_rootContextQueryIds.indexOf(queryId);
if (index < 0) { if (index < 0) {
m_qmlEngine->expressionEvaluated(queryId, value); if (QTC_GUARD(m_qmlEngine))
m_qmlEngine->expressionEvaluated(queryId, value);
} else { } else {
Q_ASSERT(index < m_engines.length()); Q_ASSERT(index < m_engines.length());
const int engineId = m_engines.at(index).debugId(); const int engineId = m_engines.at(index).debugId();

View File

@@ -77,6 +77,7 @@
#include <QSettings> #include <QSettings>
#include <QPluginLoader> #include <QPluginLoader>
#include <QTime> #include <QTime>
#include <QElapsedTimer>
#include <algorithm> #include <algorithm>
@@ -351,9 +352,9 @@ void FormEditorData::setupViewActions()
void FormEditorData::fullInit() void FormEditorData::fullInit()
{ {
QTC_ASSERT(m_initStage == FormEditorW::RegisterPlugins, return); QTC_ASSERT(m_initStage == FormEditorW::RegisterPlugins, return);
QTime *initTime = 0; QElapsedTimer *initTime = 0;
if (Designer::Constants::Internal::debug) { if (Designer::Constants::Internal::debug) {
initTime = new QTime; initTime = new QElapsedTimer;
initTime->start(); initTime->start();
} }

View File

@@ -291,7 +291,7 @@ bool GenericProject::addFiles(const QStringList &filePaths)
for (const QString &filePath : filePaths) for (const QString &filePath : filePaths)
insertSorted(&newList, baseDir.relativeFilePath(filePath)); insertSorted(&newList, baseDir.relativeFilePath(filePath));
const QSet<QString> includes = m_projectIncludePaths.toSet(); const QSet<QString> includes = Utils::toSet(m_projectIncludePaths);
QSet<QString> toAdd; QSet<QString> toAdd;
for (const QString &filePath : filePaths) { for (const QString &filePath : filePaths) {

View File

@@ -31,6 +31,8 @@
#include "qmt/model/mdependency.h" #include "qmt/model/mdependency.h"
#include "qmt/model_controller/modelcontroller.h" #include "qmt/model_controller/modelcontroller.h"
#include <utils/algorithm.h>
#include <QSet> #include <QSet>
namespace ModelEditor { namespace ModelEditor {
@@ -151,7 +153,7 @@ void PackageViewController::createAncestorDependencies(qmt::MObject *object1, qm
bool PackageViewController::haveMatchingStereotypes(const qmt::MObject *object1, bool PackageViewController::haveMatchingStereotypes(const qmt::MObject *object1,
const qmt::MObject *object2) const qmt::MObject *object2)
{ {
return !(object1->stereotypes().toSet() & object2->stereotypes().toSet()).isEmpty(); return !(Utils::toSet(object1->stereotypes()) & Utils::toSet(object2->stereotypes())).isEmpty();
} }

View File

@@ -27,7 +27,7 @@
#include <QList> #include <QList>
#include <QDialog> #include <QDialog>
#include <QTime> #include <QElapsedTimer>
#include "runcontrol.h" #include "runcontrol.h"
@@ -51,7 +51,7 @@ private:
QList<ProjectExplorer::RunControl *> m_runControls; QList<ProjectExplorer::RunControl *> m_runControls;
QLabel *m_progressLabel; QLabel *m_progressLabel;
QTime m_timer; QElapsedTimer m_timer;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -29,6 +29,7 @@
#include <coreplugin/generatedfile.h> #include <coreplugin/generatedfile.h>
#include <cpptools/abstracteditorsupport.h> #include <cpptools/abstracteditorsupport.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/macroexpander.h> #include <utils/macroexpander.h>
#include <utils/templateengine.h> #include <utils/templateengine.h>
@@ -293,8 +294,8 @@ QList<Core::GeneratedFile> PluginGenerator::generatePlugin(const GenerationPara
sm.insert(QLatin1String("PLUGIN_HEADERS"), pluginHeaders); sm.insert(QLatin1String("PLUGIN_HEADERS"), pluginHeaders);
sm.insert(QLatin1String("PLUGIN_SOURCES"), pluginSources); sm.insert(QLatin1String("PLUGIN_SOURCES"), pluginSources);
sm.insert(QLatin1String("PLUGIN_RESOURCES"), options.resourceFile); sm.insert(QLatin1String("PLUGIN_RESOURCES"), options.resourceFile);
sm.insert(QLatin1String("WIDGET_LIBS"), QStringList(widgetLibraries.toList()).join(blank)); sm.insert(QLatin1String("WIDGET_LIBS"), QStringList(Utils::toList(widgetLibraries)).join(blank));
sm.insert(QLatin1String("INCLUSIONS"), QStringList(widgetProjects.toList()).join(QLatin1Char('\n'))); sm.insert(QLatin1String("INCLUSIONS"), QStringList(Utils::toList(widgetProjects)).join(QLatin1Char('\n')));
const QString proFileContents = processTemplate(p.templatePath + QLatin1String("/tpl_plugin.pro"), sm, errorMessage); const QString proFileContents = processTemplate(p.templatePath + QLatin1String("/tpl_plugin.pro"), sm, errorMessage);
if (proFileContents.isEmpty()) if (proFileContents.isEmpty())
return QList<Core::GeneratedFile>(); return QList<Core::GeneratedFile>();

View File

@@ -385,8 +385,8 @@ void QmakePriFile::watchFolders(const QSet<FilePath> &folders)
QSet<QString> toWatch = folderStrings; QSet<QString> toWatch = folderStrings;
toWatch.subtract(m_watchedFolders); toWatch.subtract(m_watchedFolders);
m_project->unwatchFolders(toUnwatch.toList(), this); m_project->unwatchFolders(Utils::toList(toUnwatch), this);
m_project->watchFolders(toWatch.toList(), this); m_project->watchFolders(Utils::toList(toWatch), this);
m_watchedFolders = folderStrings; m_watchedFolders = folderStrings;
} }
@@ -1366,7 +1366,7 @@ QmakeEvalResult *QmakeProFile::evaluate(const QmakeEvalInput &input)
result->includedFiles.children.insert(subDirName, subDir); result->includedFiles.children.insert(subDirName, subDir);
} }
result->exactSubdirs = subDirs.toSet(); result->exactSubdirs = Utils::toSet(subDirs);
} }
// Convert ProFileReader::includeFiles to IncludedPriFile structure // Convert ProFileReader::includeFiles to IncludedPriFile structure
@@ -1691,7 +1691,7 @@ void QmakeProFile::applyEvaluate(QmakeEvalResult *evalResult)
}); });
} }
const QStringList directoriesToAdd = Utils::filtered<QStringList>( const QStringList directoriesToAdd = Utils::filtered<QStringList>(
result->directoriesWithWildcards.toList(), Utils::toList(result->directoriesWithWildcards),
[this](const QString &path) { [this](const QString &path) {
return !m_wildcardWatcher->watchesDirectory(path); return !m_wildcardWatcher->watchesDirectory(path);
}); });

View File

@@ -831,7 +831,7 @@ void CentralizedFolderWatcher::watchFolders(const QList<QString> &folders, Qmake
// we add the recursive directories we find // we add the recursive directories we find
QSet<QString> tmp = recursiveDirs(folder); QSet<QString> tmp = recursiveDirs(folder);
if (!tmp.isEmpty()) if (!tmp.isEmpty())
m_watcher.addPaths(tmp.toList()); m_watcher.addPaths(Utils::toList(tmp));
m_recursiveWatchedFolders += tmp; m_recursiveWatchedFolders += tmp;
} }
} }
@@ -927,7 +927,7 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
// If a subdirectory was added, watch it too // If a subdirectory was added, watch it too
QSet<QString> tmp = recursiveDirs(folderWithSlash); QSet<QString> tmp = recursiveDirs(folderWithSlash);
if (!tmp.isEmpty()) { if (!tmp.isEmpty()) {
QSet<QString> alreadyAdded = m_watcher.directories().toSet(); QSet<QString> alreadyAdded = Utils::toSet(m_watcher.directories());
tmp.subtract(alreadyAdded); tmp.subtract(alreadyAdded);
if (!tmp.isEmpty()) if (!tmp.isEmpty())
m_watcher.addPaths(Utils::toList(tmp)); m_watcher.addPaths(Utils::toList(tmp));

View File

@@ -179,6 +179,8 @@ void LayoutInGridLayout::doIt()
initializeCells(); initializeCells();
markUsedCells(); markUsedCells();
QTC_ASSERT(m_parentNode.isValid(), return);
if (QmlItemNode::isValidQmlItemNode(m_selectionContext.firstSelectedModelNode())) { if (QmlItemNode::isValidQmlItemNode(m_selectionContext.firstSelectedModelNode())) {
const QmlItemNode qmlItemNode = QmlItemNode(m_selectionContext.firstSelectedModelNode()); const QmlItemNode qmlItemNode = QmlItemNode(m_selectionContext.firstSelectedModelNode());
@@ -256,6 +258,10 @@ void LayoutInGridLayout::collectItemNodes()
m_qmlItemNodes.append(itemNode); m_qmlItemNodes.append(itemNode);
} }
} }
if (m_qmlItemNodes.isEmpty())
return;
m_parentNode = m_qmlItemNodes.constFirst().instanceParentItem(); m_parentNode = m_qmlItemNodes.constFirst().instanceParentItem();
} }

View File

@@ -625,9 +625,10 @@ bool QmlObjectNode::hasInstanceParent() const
bool QmlObjectNode::hasInstanceParentItem() const bool QmlObjectNode::hasInstanceParentItem() const
{ {
return nodeInstance().parentId() >= 0 return isValid()
&& nodeInstanceView()->hasInstanceForId(nodeInstance().parentId()) && nodeInstance().parentId() >= 0
&& QmlItemNode::isItemOrWindow(view()->modelNodeForInternalId(nodeInstance().parentId())); && nodeInstanceView()->hasInstanceForId(nodeInstance().parentId())
&& QmlItemNode::isItemOrWindow(view()->modelNodeForInternalId(nodeInstance().parentId()));
} }

View File

@@ -1036,7 +1036,6 @@ QmlJSEditorFactory::QmlJSEditorFactory()
addMimeType(QmlJSTools::Constants::QBS_MIMETYPE); addMimeType(QmlJSTools::Constants::QBS_MIMETYPE);
addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE); addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE);
addMimeType(QmlJSTools::Constants::JS_MIMETYPE); addMimeType(QmlJSTools::Constants::JS_MIMETYPE);
addMimeType(QmlJSTools::Constants::JSON_MIMETYPE);
setDocumentCreator([]() { return new QmlJSEditorDocument; }); setDocumentCreator([]() { return new QmlJSEditorDocument; });
setEditorWidgetCreator([]() { return new QmlJSEditorWidget; }); setEditorWidgetCreator([]() { return new QmlJSEditorWidget; });

View File

@@ -47,6 +47,7 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QDir> #include <QDir>
#include <QElapsedTimer>
#include <QGridLayout> #include <QGridLayout>
#include <QHeaderView> #include <QHeaderView>
#include <QIdentityProxyModel> #include <QIdentityProxyModel>
@@ -608,7 +609,7 @@ private:
const QColor foregroundColor2 = themeColor(Theme::Welcome_ForegroundSecondaryColor); // blacker. const QColor foregroundColor2 = themeColor(Theme::Welcome_ForegroundSecondaryColor); // blacker.
mutable QPersistentModelIndex m_previousIndex; mutable QPersistentModelIndex m_previousIndex;
mutable QTime m_startTime; mutable QElapsedTimer m_startTime;
mutable QRect m_currentArea; mutable QRect m_currentArea;
mutable QPointer<QAbstractItemView> m_currentWidget; mutable QPointer<QAbstractItemView> m_currentWidget;
mutable QVector<QPair<QString, QRect>> m_currentTagRects; mutable QVector<QPair<QString, QRect>> m_currentTagRects;

View File

@@ -67,7 +67,7 @@ Utils::FilePath UicGenerator::command() const
QStringList UicGenerator::arguments() const QStringList UicGenerator::arguments() const
{ {
return {source().toString()}; return {"-p", source().toString()};
} }
FileNameToContentsHash UicGenerator::handleProcessFinished(QProcess *process) FileNameToContentsHash UicGenerator::handleProcessFinished(QProcess *process)
@@ -81,7 +81,9 @@ FileNameToContentsHash UicGenerator::handleProcessFinished(QProcess *process)
return result; return result;
// As far as I can discover in the UIC sources, it writes out local 8-bit encoding. The // As far as I can discover in the UIC sources, it writes out local 8-bit encoding. The
// conversion below is to normalize both the encoding, and the line terminators. // conversion below is to normalize both the encoding, and the line terminators.
result[targetList.first()] = QString::fromLocal8Bit(process->readAllStandardOutput()).toUtf8(); QByteArray content = QString::fromLocal8Bit(process->readAllStandardOutput()).toUtf8();
content.prepend("#pragma once\n");
result[targetList.first()] = content;
return result; return result;
} }

View File

@@ -33,12 +33,13 @@
#include <ssh/sshconnection.h> #include <ssh/sshconnection.h>
#include <ssh/sshremoteprocess.h> #include <ssh/sshremoteprocess.h>
#include <QDateTime>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QList>
#include <QString>
#include <QDateTime>
#include <QHash> #include <QHash>
#include <QList>
#include <QQueue>
#include <QString>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace QSsh; using namespace QSsh;
@@ -48,6 +49,8 @@ namespace Internal {
enum State { Inactive, PreChecking, Uploading, PostProcessing }; enum State { Inactive, PreChecking, Uploading, PostProcessing };
const int MaxConcurrentStatCalls = 10;
class GenericDirectUploadServicePrivate class GenericDirectUploadServicePrivate
{ {
public: public:
@@ -63,6 +66,7 @@ public:
bool incremental = false; bool incremental = false;
bool ignoreMissingFiles = false; bool ignoreMissingFiles = false;
QHash<SshRemoteProcess *, DeployableFile> remoteProcs; QHash<SshRemoteProcess *, DeployableFile> remoteProcs;
QQueue<DeployableFile> filesToStat;
State state = Inactive; State state = Inactive;
QList<DeployableFile> filesToUpload; QList<DeployableFile> filesToUpload;
SftpTransferPtr uploader; SftpTransferPtr uploader;
@@ -132,11 +136,12 @@ void GenericDirectUploadService::doDeploy()
} }
QDateTime GenericDirectUploadService::timestampFromStat(const DeployableFile &file, QDateTime GenericDirectUploadService::timestampFromStat(const DeployableFile &file,
SshRemoteProcess *statProc) SshRemoteProcess *statProc,
const QString &errorMsg)
{ {
QString errorDetails; QString errorDetails;
if (statProc->exitStatus() != QProcess::NormalExit) if (!errorMsg.isEmpty())
errorDetails = statProc->errorString(); errorDetails = errorMsg;
else if (statProc->exitCode() != 0) else if (statProc->exitCode() != 0)
errorDetails = QString::fromUtf8(statProc->readAllStandardError()); errorDetails = QString::fromUtf8(statProc->readAllStandardError());
if (!errorDetails.isEmpty()) { if (!errorDetails.isEmpty()) {
@@ -168,6 +173,8 @@ QDateTime GenericDirectUploadService::timestampFromStat(const DeployableFile &fi
void GenericDirectUploadService::checkForStateChangeOnRemoteProcFinished() void GenericDirectUploadService::checkForStateChangeOnRemoteProcFinished()
{ {
if (d->remoteProcs.size() < MaxConcurrentStatCalls && !d->filesToStat.isEmpty())
runStat(d->filesToStat.dequeue());
if (!d->remoteProcs.isEmpty()) if (!d->remoteProcs.isEmpty())
return; return;
if (d->state == PreChecking) { if (d->state == PreChecking) {
@@ -188,6 +195,39 @@ void GenericDirectUploadService::stopDeployment()
handleDeploymentDone(); handleDeploymentDone();
} }
void GenericDirectUploadService::runStat(const DeployableFile &file)
{
// We'd like to use --format=%Y, but it's not supported by busybox.
const QString statCmd = "stat -t " + Utils::QtcProcess::quoteArgUnix(file.remoteFilePath());
SshRemoteProcess * const statProc = connection()->createRemoteProcess(statCmd).release();
statProc->setParent(this);
connect(statProc, &SshRemoteProcess::done, this,
[this, statProc, state = d->state](const QString &errorMsg) {
QTC_ASSERT(d->state == state, return);
const DeployableFile file = d->getFileForProcess(statProc);
QTC_ASSERT(file.isValid(), return);
const QDateTime timestamp = timestampFromStat(file, statProc, errorMsg);
statProc->deleteLater();
switch (state) {
case PreChecking:
if (!timestamp.isValid() || hasRemoteFileChanged(file, timestamp))
d->filesToUpload.append(file);
break;
case PostProcessing:
if (timestamp.isValid())
saveDeploymentTimeStamp(file, timestamp);
break;
case Inactive:
case Uploading:
QTC_CHECK(false);
break;
}
checkForStateChangeOnRemoteProcFinished();
});
d->remoteProcs.insert(statProc, file);
statProc->start();
}
QList<DeployableFile> GenericDirectUploadService::collectFilesToUpload( QList<DeployableFile> GenericDirectUploadService::collectFilesToUpload(
const DeployableFile &deployable) const const DeployableFile &deployable) const
{ {
@@ -212,6 +252,7 @@ QList<DeployableFile> GenericDirectUploadService::collectFilesToUpload(
void GenericDirectUploadService::setFinished() void GenericDirectUploadService::setFinished()
{ {
d->state = Inactive; d->state = Inactive;
d->filesToStat.clear();
for (auto it = d->remoteProcs.begin(); it != d->remoteProcs.end(); ++it) { for (auto it = d->remoteProcs.begin(); it != d->remoteProcs.end(); ++it) {
it.key()->disconnect(); it.key()->disconnect();
it.key()->terminate(); it.key()->terminate();
@@ -237,35 +278,10 @@ void GenericDirectUploadService::queryFiles()
d->filesToUpload.append(file); d->filesToUpload.append(file);
continue; continue;
} }
// We'd like to use --format=%Y, but it's not supported by busybox. if (d->remoteProcs.size() >= MaxConcurrentStatCalls)
const QString statCmd = "stat -t " + Utils::QtcProcess::quoteArgUnix(file.remoteFilePath()); d->filesToStat << file;
SshRemoteProcess * const statProc = connection()->createRemoteProcess(statCmd).release(); else
statProc->setParent(this); runStat(file);
connect(statProc, &SshRemoteProcess::done, this,
[this, statProc, state = d->state] {
QTC_ASSERT(d->state == state, return);
const DeployableFile file = d->getFileForProcess(statProc);
QTC_ASSERT(file.isValid(), return);
const QDateTime timestamp = timestampFromStat(file, statProc);
statProc->deleteLater();
switch (state) {
case PreChecking:
if (!timestamp.isValid() || hasRemoteFileChanged(file, timestamp))
d->filesToUpload.append(file);
break;
case PostProcessing:
if (timestamp.isValid())
saveDeploymentTimeStamp(file, timestamp);
break;
case Inactive:
case Uploading:
QTC_CHECK(false);
break;
}
checkForStateChangeOnRemoteProcFinished();
});
d->remoteProcs.insert(statProc, file);
statProc->start();
} }
checkForStateChangeOnRemoteProcFinished(); checkForStateChangeOnRemoteProcFinished();
} }

View File

@@ -61,8 +61,9 @@ public:
void stopDeployment() override; void stopDeployment() override;
private: private:
void runStat(const ProjectExplorer::DeployableFile &file);
QDateTime timestampFromStat(const ProjectExplorer::DeployableFile &file, QDateTime timestampFromStat(const ProjectExplorer::DeployableFile &file,
QSsh::SshRemoteProcess *statProc); QSsh::SshRemoteProcess *statProc, const QString &errorMsg);
void checkForStateChangeOnRemoteProcFinished(); void checkForStateChangeOnRemoteProcFinished();
QList<ProjectExplorer::DeployableFile> collectFilesToUpload( QList<ProjectExplorer::DeployableFile> collectFilesToUpload(

View File

@@ -59,8 +59,8 @@ void CppTodoItemsScanner::scannerParamsChanged()
QSet<QString> filesToBeUpdated; QSet<QString> filesToBeUpdated;
foreach (const CppTools::ProjectInfo &info, modelManager->projectInfos()) foreach (const CppTools::ProjectInfo &info, modelManager->projectInfos())
filesToBeUpdated.unite(Utils::transform(info.project().data()->files(ProjectExplorer::Project::SourceFiles), filesToBeUpdated.unite(Utils::transform<QSet>(info.project().data()->files(ProjectExplorer::Project::SourceFiles),
&Utils::FilePath::toString).toSet()); &Utils::FilePath::toString));
modelManager->updateSourceFiles(filesToBeUpdated); modelManager->updateSourceFiles(filesToBeUpdated);
} }

View File

@@ -116,7 +116,7 @@ void OptionsDialog::editKeyword(QListWidgetItem *item)
Keyword keyword; Keyword keyword;
keyword.name = item->text(); keyword.name = item->text();
keyword.iconType = static_cast<IconType>(item->data(Qt::UserRole).toInt()); keyword.iconType = static_cast<IconType>(item->data(Qt::UserRole).toInt());
keyword.color = item->textColor(); keyword.color = item->foreground().color();
QSet<QString> keywordNamesButThis = keywordNames(); QSet<QString> keywordNamesButThis = keywordNames();
keywordNamesButThis.remove(keyword.name); keywordNamesButThis.remove(keyword.name);
@@ -127,7 +127,7 @@ void OptionsDialog::editKeyword(QListWidgetItem *item)
item->setIcon(icon(keyword.iconType)); item->setIcon(icon(keyword.iconType));
item->setText(keyword.name); item->setText(keyword.name);
item->setData(Qt::UserRole, static_cast<int>(keyword.iconType)); item->setData(Qt::UserRole, static_cast<int>(keyword.iconType));
item->setTextColor(keyword.color); item->setForeground(keyword.color);
} }
} }

View File

@@ -195,14 +195,24 @@ isEmpty(LLVM_VERSION) {
LLVM_STATIC_LIBS = $$split(LLVM_STATIC_LIBS_STRING, " ") LLVM_STATIC_LIBS = $$split(LLVM_STATIC_LIBS_STRING, " ")
CLANGFORMAT_MAIN_HEADER = $$LLVM_INCLUDEPATH/clang/Format/Format.h win32 {
exists($$CLANGFORMAT_MAIN_HEADER) { LLVM_BUILDMODE = $$system($$llvm_config --build-mode, lines)
CLANGFORMAT_LIBS=-lclangFormat -lclangToolingInclusions -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic CONFIG(debug, debug|release):!equals(LLVM_BUILDMODE, "Debug") {
ALL_CLANG_LIBS=-lclangFormat -lclangToolingInclusions -lclangTooling -lclangToolingCore \ message("Mismatching build config (Debug vs Release) setting QTC_CLANG_BUILDMODE_MISMATCH")
-lclangRewrite -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \ QTC_CLANG_BUILDMODE_MISMATCH=1
-lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \ }
-lclangASTMatchers -lclangAST -lclangLex -lclangBasic }
win32:CLANGFORMAT_LIBS += -lversion
isEmpty(QTC_CLANG_BUILDMODE_MISMATCH)|!equals(QTC_CLANG_BUILDMODE_MISMATCH, 1) {
CLANGFORMAT_MAIN_HEADER = $$LLVM_INCLUDEPATH/clang/Format/Format.h
exists($$CLANGFORMAT_MAIN_HEADER) {
CLANGFORMAT_LIBS=-lclangFormat -lclangToolingInclusions -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic
ALL_CLANG_LIBS=-lclangFormat -lclangToolingInclusions -lclangTooling -lclangToolingCore \
-lclangRewrite -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \
-lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \
-lclangASTMatchers -lclangAST -lclangLex -lclangBasic
win32:CLANGFORMAT_LIBS += -lversion
}
} }
win32:ALL_CLANG_LIBS += -lversion win32:ALL_CLANG_LIBS += -lversion
@@ -225,10 +235,12 @@ isEmpty(LLVM_VERSION) {
!contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): LIBCLANG_LIBS = -L$${LLVM_LIBDIR} !contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): LIBCLANG_LIBS = -L$${LLVM_LIBDIR}
LIBCLANG_LIBS += $${CLANG_LIB} LIBCLANG_LIBS += $${CLANG_LIB}
QTC_DISABLE_CLANG_REFACTORING=$$(QTC_DISABLE_CLANG_REFACTORING) isEmpty(QTC_CLANG_BUILDMODE_MISMATCH)|!equals(QTC_CLANG_BUILDMODE_MISMATCH, 1) {
isEmpty(QTC_DISABLE_CLANG_REFACTORING) { QTC_DISABLE_CLANG_REFACTORING=$$(QTC_DISABLE_CLANG_REFACTORING)
!contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): LIBTOOLING_LIBS = -L$${LLVM_LIBDIR} isEmpty(QTC_DISABLE_CLANG_REFACTORING) {
LIBTOOLING_LIBS += $$CLANGTOOLING_LIBS $$LLVM_STATIC_LIBS !contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): LIBTOOLING_LIBS = -L$${LLVM_LIBDIR}
LIBTOOLING_LIBS += $$CLANGTOOLING_LIBS $$LLVM_STATIC_LIBS
}
} }
!isEmpty(CLANGFORMAT_LIBS) { !isEmpty(CLANGFORMAT_LIBS) {

View File

@@ -103,7 +103,7 @@ void ClangCodeModelServer::documentsOpened(const ClangBackEnd::DocumentsOpenedMe
document.setDirtyIfDependencyIsMet(document.filePath()); document.setDirtyIfDependencyIsMet(document.filePath());
DocumentProcessor processor = documentProcessors().create(document); DocumentProcessor processor = documentProcessors().create(document);
processor.jobs().setJobFinishedCallback([this](const Jobs::RunningJob &a, IAsyncJob *b) { processor.jobs().setJobFinishedCallback([this](const Jobs::RunningJob &a, IAsyncJob *b) {
onJobFinished(a, b); return onJobFinished(a, b);
}); });
} }
const std::vector<Document> resetDocuments_ = resetDocuments(toReset); const std::vector<Document> resetDocuments_ = resetDocuments(toReset);
@@ -401,12 +401,14 @@ void ClangCodeModelServer::processSuspendResumeJobs(const std::vector<Document>
} }
} }
void ClangCodeModelServer::onJobFinished(const Jobs::RunningJob &jobRecord, IAsyncJob *job) bool ClangCodeModelServer::onJobFinished(const Jobs::RunningJob &jobRecord, IAsyncJob *job)
{ {
if (jobRecord.jobRequest.type == JobRequest::Type::UpdateAnnotations) { if (jobRecord.jobRequest.type == JobRequest::Type::UpdateAnnotations) {
const auto updateJob = static_cast<UpdateAnnotationsJob *>(job); const auto updateJob = static_cast<UpdateAnnotationsJob *>(job);
resetDocumentsWithUnresolvedIncludes({updateJob->pinnedDocument()}); return resetDocumentsWithUnresolvedIncludes({updateJob->pinnedDocument()});
} }
return false;
} }
void ClangCodeModelServer::categorizeFileContainers(const QVector<FileContainer> &fileContainers, void ClangCodeModelServer::categorizeFileContainers(const QVector<FileContainer> &fileContainers,
@@ -476,7 +478,7 @@ static bool isDocumentWithUnresolvedIncludesFixable(const Document &document,
return false; return false;
} }
void ClangCodeModelServer::resetDocumentsWithUnresolvedIncludes( int ClangCodeModelServer::resetDocumentsWithUnresolvedIncludes(
const std::vector<Document> &documents) const std::vector<Document> &documents)
{ {
DocumentResetInfos toReset; DocumentResetInfos toReset;
@@ -489,6 +491,8 @@ void ClangCodeModelServer::resetDocumentsWithUnresolvedIncludes(
} }
resetDocuments(toReset); resetDocuments(toReset);
return toReset.size();
} }
void ClangCodeModelServer::setUpdateAnnotationsTimeOutInMsForTestsOnly(int value) void ClangCodeModelServer::setUpdateAnnotationsTimeOutInMsForTestsOnly(int value)

View File

@@ -83,13 +83,13 @@ private:
void processTimerForVisibleButNotCurrentDocuments(); void processTimerForVisibleButNotCurrentDocuments();
void processSuspendResumeJobs(const std::vector<Document> &documents); void processSuspendResumeJobs(const std::vector<Document> &documents);
void onJobFinished(const Jobs::RunningJob &jobRecord, IAsyncJob *job); bool onJobFinished(const Jobs::RunningJob &jobRecord, IAsyncJob *job);
void categorizeFileContainers(const QVector<FileContainer> &fileContainers, void categorizeFileContainers(const QVector<FileContainer> &fileContainers,
QVector<FileContainer> &toCreate, QVector<FileContainer> &toCreate,
DocumentResetInfos &toReset) const; DocumentResetInfos &toReset) const;
std::vector<Document> resetDocuments(const DocumentResetInfos &infos); std::vector<Document> resetDocuments(const DocumentResetInfos &infos);
void resetDocumentsWithUnresolvedIncludes(const std::vector<Document> &documents); int resetDocumentsWithUnresolvedIncludes(const std::vector<Document> &documents);
void addAndRunUpdateJobs(std::vector<Document> documents); void addAndRunUpdateJobs(std::vector<Document> documents);

Some files were not shown because too many files have changed in this diff Show More