Merge remote-tracking branch 'origin/11.0' into qds/dev
Change-Id: I79a272471b3400eec0a0fa9fca175d1d4a8c0a13
BIN
doc/qtcreator/images/icons/copilot.png
Normal file
|
After Width: | Height: | Size: 257 B |
BIN
doc/qtcreator/images/icons/terminal-close.png
Normal file
|
After Width: | Height: | Size: 257 B |
BIN
doc/qtcreator/images/icons/terminal-create.png
Normal file
|
After Width: | Height: | Size: 235 B |
BIN
doc/qtcreator/images/qtcreator-copilot.gif
Normal file
|
After Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
BIN
doc/qtcreator/images/qtcreator-output-panes-taskbar.webp
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
doc/qtcreator/images/qtcreator-output-terminal.webp
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
doc/qtcreator/images/qtcreator-preferences-copilot.webp
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
doc/qtcreator/images/qtcreator-preferences-terminal.webp
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
// **********************************************************************
|
||||
@@ -79,6 +79,12 @@
|
||||
programming languages besides C++. In addition, it integrates
|
||||
diagnostics from the language server.
|
||||
|
||||
\li \l {Using GitHub Copilot}
|
||||
|
||||
The experimental Copilot plugin integrates
|
||||
\l{https://github.com/features/copilot}{GitHub Copilot} into \QC.
|
||||
You can view suggestions from Copilot in the code editor.
|
||||
|
||||
\li \l{Editing MIME Types}
|
||||
|
||||
\QC uses the MIME type of a file to determine which mode and editor
|
||||
|
||||
@@ -74,6 +74,11 @@
|
||||
|
||||
\section2 Locating Files
|
||||
|
||||
You can locate files in the local file system or on connected devices. By
|
||||
default, the file system filter shows the files in the same folder as the
|
||||
currently open file and lets you navigate the file system. Also, it shows
|
||||
items that let you switch to another device root.
|
||||
|
||||
For example, to open a QML file called \e HelloWorld.qml in the currently
|
||||
open project using the locator:
|
||||
|
||||
@@ -143,16 +148,19 @@
|
||||
such as \c {Utils::*View}.
|
||||
\endif
|
||||
|
||||
\section2 Creating Files from Locator
|
||||
\section2 Creating Files and Directories from Locator
|
||||
|
||||
To create a new file and open it in the editor, type \c f
|
||||
followed by \key Space, followed by path and file name, and then press
|
||||
\key Enter.
|
||||
\key Enter or select \uicontrol {Create and Open File}. To create a
|
||||
directory, select \uicontrol {Create Directory}.
|
||||
|
||||
\section2 Opening Sessions from Locator
|
||||
|
||||
You can use the filter that triggers menu commands to open
|
||||
\l{Managing Sessions}{sessions}. Enter
|
||||
\c {t yoursess} or \c {t sess yoursess} to trigger \uicontrol File >
|
||||
\uicontrol Sessions > \e yoursessionname.
|
||||
\uicontrol Sessions > \e <session_name>.
|
||||
|
||||
\section2 Default Filters
|
||||
|
||||
|
||||
96
doc/qtcreator/src/editors/creator-only/creator-copilot.qdoc
Normal file
@@ -0,0 +1,96 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
\previouspage creator-language-servers.html
|
||||
\page creator-copilot.html
|
||||
\nextpage creator-mime-types.html
|
||||
|
||||
\title Using GitHub Copilot
|
||||
|
||||
The experimental Copilot plugin integrates
|
||||
\l{https://github.com/features/copilot}{GitHub Copilot} into \QC.
|
||||
You can view suggestions from Copilot in the \uicontrol Edit mode.
|
||||
|
||||
\section1 Requirements
|
||||
|
||||
To use the Copilot plugin, you need:
|
||||
|
||||
\list
|
||||
\li An active \l{https://docs.github.com/en/billing/managing-billing-for-github-copilot/about-billing-for-github-copilot}
|
||||
{GitHub Copilot subscription}.
|
||||
\li GitHub Copilot Neovim plugin installed, as described in
|
||||
\l{https://docs.github.com/en/copilot/getting-started-with-github-copilot?tool=neovim}
|
||||
{About GitHub Copilot and Neovim}.
|
||||
\endlist
|
||||
|
||||
\section1 Enabling the Copilot Plugin
|
||||
|
||||
To enable the Copilot plugin:
|
||||
|
||||
\list 1
|
||||
\li Select \uicontrol Help > \uicontrol {About Plugins} >
|
||||
\uicontrol Utilities > \uicontrol Copilot to enable the plugin.
|
||||
\li Select \uicontrol {Restart Now} to restart \QC and load the plugin.
|
||||
\endlist
|
||||
|
||||
\section1 Setting Copilot Preferences
|
||||
|
||||
To set preferences for using Copilot:
|
||||
|
||||
\list 1
|
||||
\li Select \uicontrol Edit > \uicontrol Preferences >
|
||||
\uicontrol Copilot.
|
||||
\image qtcreator-preferences-copilot.webp {Copilot tab in Preferences}
|
||||
\li Select \uicontrol {Sign In} to sign into your subscription, activate
|
||||
your device, and authorize the GitHub Copilot plugin.
|
||||
|
||||
The button turns into a \uicontrol {Sign Out} button.
|
||||
\li Select the \uicontrol {Enable Copilot} check box to use Copilot.
|
||||
\li In the \uicontrol {Node.js path} field, enter the full path to the
|
||||
Node.js executable.
|
||||
\li In the \uicontrol {Path to agent.js} field, enter the path to
|
||||
agent.js in the Copilot Neovim plugin.
|
||||
\li Select the \uicontrol {Request completions automatically} checkbox to
|
||||
receive suggestions for the current text cursor position when you
|
||||
make changes.
|
||||
\endlist
|
||||
|
||||
\section1 Pair-Programming with Copilot
|
||||
|
||||
When you write code in the \l {Working in Edit Mode}{Edit} mode and
|
||||
\uicontrol {Request completions automatically} is enabled, Copilot
|
||||
automatically makes suggestions when you type.
|
||||
|
||||
\image qtcreator-copilot.gif {Receiving suggestions from Copilot in the editor}
|
||||
|
||||
To manually request a suggestion at the current editor's cursor position,
|
||||
select \uicontrol {Request Copilot Suggestion} in the context menu.
|
||||
|
||||
Hover the mouse over a suggestion to show a toolbar with
|
||||
\inlineimage icons/prev.png
|
||||
and \inlineimage icons/next.png
|
||||
buttons for cycling between Copilot suggestions.
|
||||
|
||||
To apply a suggestion as a whole, select \uicontrol Apply or press
|
||||
the \key Tab key.
|
||||
|
||||
To apply a suggestion word-by-word, select \uicontrol {Apply Word}
|
||||
or press \key {Alt+Right}.
|
||||
|
||||
\section1 Enabling and Disabling Copilot
|
||||
|
||||
You can enable and disable the Copilot plugin either globally for all
|
||||
projects or at project level for a particular project.
|
||||
|
||||
To enable or disable Copilot suggestions globally, select the
|
||||
\inlineimage icons/copilot.png
|
||||
(\uicontrol {Toggle Copilot}) button. This also sets the value of the
|
||||
\uicontrol {Enable Copilot} check box in \uicontrol Edit >
|
||||
\uicontrol Preferences accordingly.
|
||||
|
||||
To enable or disable Copilot suggestions for a particular project,
|
||||
select \uicontrol Projects > \uicontrol {Project Settings} >
|
||||
\uicontrol Copilot, and then select or deselect the
|
||||
\uicontrol {Enable Copilot} check box.
|
||||
*/
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
\previouspage creator-markdown-editor.html
|
||||
\page creator-language-servers.html
|
||||
\nextpage creator-mime-types.html
|
||||
\nextpage creator-copilot.html
|
||||
|
||||
\title Using Language Servers
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
// **********************************************************************
|
||||
@@ -8,7 +8,7 @@
|
||||
// **********************************************************************
|
||||
|
||||
/*!
|
||||
\previouspage creator-language-servers.html
|
||||
\previouspage creator-copilot.html
|
||||
\page creator-mime-types.html
|
||||
\nextpage creator-modeling.html
|
||||
|
||||
|
||||
@@ -482,8 +482,9 @@
|
||||
\row
|
||||
\li Add Class Member
|
||||
\li Adds a member declaration for the class member being
|
||||
initialized if it is not yet declared. You must enter
|
||||
the data type of the member.
|
||||
initialized if it is not yet declared. If \QC cannot
|
||||
automatically detect the data type of the member, you
|
||||
must add it.
|
||||
\li Identifier
|
||||
\row
|
||||
\li Create Implementations for Member Functions
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
\li Alt+O
|
||||
\row
|
||||
\li Maximize output views
|
||||
\li Alt+9
|
||||
\li Alt+Shift+9
|
||||
\row
|
||||
\li Move to next item in output
|
||||
\li F6
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
a build, detailed output from the compiler, status of a program when it is
|
||||
executed, debug output, or search results.
|
||||
|
||||
\image qtcreator-output-panes-taskbar.png "Output on the taskbar"
|
||||
\image qtcreator-output-panes-taskbar.webp "Output on the taskbar"
|
||||
|
||||
To view different types of output, use the following shortcuts:
|
||||
|
||||
|
||||
@@ -239,7 +239,9 @@
|
||||
For console applications that require input, select \uicontrol Projects >
|
||||
\uicontrol {Run Settings} > \uicontrol {Run in terminal}. To specify the
|
||||
terminal to use, select \uicontrol Edit > \uicontrol Preferences >
|
||||
\uicontrol Environment > \uicontrol System.
|
||||
\uicontrol Environment > \uicontrol System. To use an \l{Terminal}
|
||||
{internal terminal}, select \uicontrol Edit > \uicontrol Preferences
|
||||
> \uicontrol Terminal > \uicontrol {Use internal terminal}.
|
||||
|
||||
\b {On Windows:} Output is displayed differently for \e{console
|
||||
applications} and \e{GUI applications}.
|
||||
|
||||
@@ -99,4 +99,7 @@
|
||||
|
||||
\image qtcreator-toggle-progress-bar.webp {Toggle Progress Details button}
|
||||
|
||||
You can drag the progress bar to another position. The position is saved for
|
||||
later. Select the \inlineimage icons/pin.png
|
||||
(\uicontrol Pin) button to pin the progress bar back to the toggle button.
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,10 @@
|
||||
|
||||
For console applications, check the \uicontrol{Run in terminal} check box.
|
||||
To specify the terminal to use on Linux and \macos, select \uicontrol Edit
|
||||
> \uicontrol Preferences > \uicontrol Environment > \uicontrol System.
|
||||
> \uicontrol Preferences > \uicontrol Environment > \uicontrol System. To use
|
||||
an \l{Terminal}{internal terminal}, select \uicontrol Edit >
|
||||
\uicontrol Preferences > \uicontrol Terminal >
|
||||
\uicontrol {Use internal terminal}.
|
||||
|
||||
To run with special environment variables set up, select them in the
|
||||
\uicontrol {Run Environment} section. For more information, see
|
||||
|
||||
@@ -130,6 +130,7 @@
|
||||
\endlist
|
||||
\li \l{Editing Markdown Files}
|
||||
\li \l{Using Language Servers}
|
||||
\li \l{Using GitHub Copilot}
|
||||
\li \l{Editing MIME Types}
|
||||
\li \l{Modeling}
|
||||
\li \l{Editing State Charts}
|
||||
|
||||
@@ -60,7 +60,9 @@
|
||||
\li Open a terminal window in the selected directory or in the directory
|
||||
that has the file. To specify the terminal to use on Linux and
|
||||
\macos, select \uicontrol Edit > \uicontrol Preferences >
|
||||
\uicontrol Environment > \uicontrol System.
|
||||
\uicontrol Environment > \uicontrol System. To use an \l{Terminal}
|
||||
{internal terminal}, select \uicontrol Edit > \uicontrol Preferences
|
||||
> \uicontrol Terminal > \uicontrol {Use internal terminal}.
|
||||
\li Search from the selected directory.
|
||||
\li View file properties, such as name, path, MIME type, default editor,
|
||||
line endings, indentation, owner, size, last read and modified
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
\li Open a terminal window in the project directory. To specify the
|
||||
terminal to use on Linux and \macos, select \uicontrol Edit >
|
||||
\uicontrol Preferences > \uicontrol Environment > \uicontrol System.
|
||||
To use an \l{Terminal}{internal terminal}, select \uicontrol Edit >
|
||||
\uicontrol Preferences > \uicontrol Terminal >
|
||||
\uicontrol {Use internal terminal}.
|
||||
\li Open a terminal window in the project directory that you configured
|
||||
for building or running the project.
|
||||
\li Expand or collapse the tree view to show or hide all files and
|
||||
|
||||
@@ -376,13 +376,17 @@
|
||||
|
||||
\list
|
||||
|
||||
\li \uicontrol{Issues}
|
||||
\li \l {Issues}
|
||||
|
||||
\li \uicontrol{Search Results}
|
||||
\li \l {Search Results}
|
||||
|
||||
\li \uicontrol{Application Output}
|
||||
\li \l {Application Output}
|
||||
|
||||
\li \uicontrol{Compile Output}
|
||||
\li \l {Compile Output}
|
||||
|
||||
\if defined(qtcreator)
|
||||
\li \l {Terminal}
|
||||
\endif
|
||||
|
||||
\li \uicontrol {QML Debugger Console}
|
||||
|
||||
@@ -396,7 +400,7 @@
|
||||
\li \l{Using Squish}{Squish} test results and Squish Server and
|
||||
Runner logs
|
||||
|
||||
\li \uicontrol {To-Do Entries}
|
||||
\li \l {To-Do Entries}
|
||||
|
||||
\endif
|
||||
|
||||
@@ -404,7 +408,7 @@
|
||||
|
||||
Output is available on the taskbar in all \l{Selecting Modes}{modes}.
|
||||
|
||||
\image qtcreator-output-panes-taskbar.png "Output on the taskbar"
|
||||
\image qtcreator-output-panes-taskbar.webp "Output on the taskbar"
|
||||
|
||||
You can view output in the following ways:
|
||||
|
||||
@@ -415,7 +419,8 @@
|
||||
\li Select \inlineimage icons/output-pane-menu.png
|
||||
, and then select the view to open.
|
||||
\li Select \uicontrol View > \uicontrol Output.
|
||||
The menu items also display the keyboard shortcuts that you can use.
|
||||
The menu items also display the \l{Keyboard Shortcuts}
|
||||
{keyboard shortcuts} that you can use.
|
||||
\endlist
|
||||
|
||||
To maximize an open output view, select the \inlineimage icons/arrowup.png
|
||||
@@ -644,6 +649,101 @@
|
||||
\endlist
|
||||
|
||||
\if defined(qtcreator)
|
||||
|
||||
\section1 Terminal
|
||||
|
||||
When you select the \uicontrol {Run in Terminal} check box and run an
|
||||
application or the \uicontrol {Open Terminal} button to open a terminal,
|
||||
the default terminal opens. On Linux and \macos, you can set the default
|
||||
terminal by selecting \uicontrol Edit > \uicontrol Preferences >
|
||||
\uicontrol Environment > \uicontrol System.
|
||||
|
||||
To open the terminal on the taskbar instead of in a separate window, select
|
||||
\uicontrol Edit > \uicontrol Preferences > \uicontrol Terminal >
|
||||
\uicontrol {Use internal terminal}.
|
||||
|
||||
\image qtcreator-output-terminal.webp {Terminal pane}
|
||||
|
||||
To clear the terminal, select \inlineimage icons/clean_pane_small.png
|
||||
(\uicontrol Clear).
|
||||
|
||||
To close the current terminal, select \inlineimage icons/terminal-close.png
|
||||
.
|
||||
|
||||
To open new terminals as tabs, select \inlineimage icons/terminal-create.png
|
||||
.
|
||||
|
||||
To move between terminals, select the tabs or \inlineimage icons/arrowup.png
|
||||
and \inlineimage icons/arrowdown.png
|
||||
.
|
||||
|
||||
To select a word in a terminal, double-click it. To select the whole line,
|
||||
triple-click it.
|
||||
|
||||
To open links in a browser, files in the editor, or folders in the
|
||||
\l Projects view, hover the mouse over them, and press \key Ctrl.
|
||||
|
||||
To \l{Finding and Replacing}{search} through the output, press \key {Ctrl+F}.
|
||||
|
||||
To make the font larger or smaller, select the \inlineimage icons/plus.png
|
||||
and \inlineimage icons/minus.png
|
||||
buttons. You can also change the font size in terminal preferences.
|
||||
|
||||
To open terminal preferences, select \inlineimage icons/settings.png
|
||||
(\uicontrol Configure).
|
||||
|
||||
Most of the \QC keyboard shortcuts are disabled in the terminal, except the
|
||||
ones for opening terminal preferences or the locator and quitting \QC. To
|
||||
send the escape key to the terminal instead of closing the terminal, select
|
||||
\uicontrol {Shift+Esc}. You can also specify that the escape key is sent to
|
||||
the terminal in terminal preferences.
|
||||
|
||||
\section2 Setting Terminal Preferences
|
||||
|
||||
To set preferences for the internal terminal, select \uicontrol Edit >
|
||||
\uicontrol Preferences > \uicontrol Terminal, or select the
|
||||
\uicontrol Configure button in the \uicontrol Terminal pane.
|
||||
|
||||
\image qtcreator-preferences-terminal.webp {Terminal tab in Preferences}
|
||||
|
||||
\table
|
||||
\header
|
||||
\li Option
|
||||
\li Value
|
||||
\row
|
||||
\li \uicontrol {Use internal terminal}
|
||||
\li Open the \uicontrol Terminal pane when you select
|
||||
\uicontrol {Run in Terminal} or \uicontrol {Open Terminal}.
|
||||
\row
|
||||
\li \uicontrol {Send escape key to terminal}
|
||||
\li Send the escape key to the terminal instead of closing the terminal.
|
||||
\row
|
||||
\li \uicontrol {Audible bell}
|
||||
\li Play an audible bell when the a bell character is received.
|
||||
\row
|
||||
\li \uicontrol {Allow blinking cursor}
|
||||
\li Allow the cursor to blink.
|
||||
\row
|
||||
\li \uicontrol {Font}
|
||||
\li Select the \uicontrol {Font family} and \uicontrol Size for the text
|
||||
in the terminal. You can also use the \inlineimage icons/plus.png
|
||||
and \inlineimage icons/minus.png buttons in the \uicontrol Terminal
|
||||
pane to change the font size.
|
||||
\row
|
||||
\li \uicontrol {Colors}
|
||||
\li Set colors for the \uicontrol Terminal pane \uicontrol Foreground,
|
||||
\uicontrol Background, \uicontrol Selection, and
|
||||
\uicontrol {Find match}.
|
||||
\row
|
||||
\li \uicontrol {Default shell}
|
||||
\li Set the full path to the default terminal executable in
|
||||
\uicontrol {Shell path} and the arguments to pass to the shell
|
||||
in \uicontrol {Shell arguments}.
|
||||
\endtable
|
||||
|
||||
To use an existing color scheme, select \uicontrol {Load Theme}. To revert
|
||||
color changes, select \uicontrol {Reset Theme}.
|
||||
|
||||
\section1 To-Do Entries
|
||||
|
||||
\uicontrol {To-Do Entries} lists the BUG, FIXME, NOTE, TODO, and
|
||||
|
||||
@@ -647,7 +647,7 @@ int main(int argc, char **argv)
|
||||
for (QString locale : std::as_const(uiLanguages)) {
|
||||
locale = QLocale(locale).name();
|
||||
if (translator.load("qtcreator_" + locale, creatorTrPath)) {
|
||||
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
const QString &qtTrPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||
const QString &qtTrFile = QLatin1String("qt_") + locale;
|
||||
// Binary installer puts Qt tr files into creatorTrPath
|
||||
if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, creatorTrPath)) {
|
||||
|
||||
@@ -399,7 +399,7 @@ static QString filled(const QString &s, int min)
|
||||
QString PluginManager::systemInformation()
|
||||
{
|
||||
QString result;
|
||||
CommandLine qtDiag(FilePath::fromString(QLibraryInfo::location(QLibraryInfo::BinariesPath))
|
||||
CommandLine qtDiag(FilePath::fromString(QLibraryInfo::path(QLibraryInfo::BinariesPath))
|
||||
.pathAppended("qtdiag").withExecutableSuffix());
|
||||
Process qtDiagProc;
|
||||
qtDiagProc.setCommand(qtDiag);
|
||||
|
||||
@@ -369,61 +369,62 @@ LibraryInfo::LibraryInfo(const QmlDirParser &parser, const QByteArray &fingerpri
|
||||
QByteArray LibraryInfo::calculateFingerprint() const
|
||||
{
|
||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||
hash.addData(reinterpret_cast<const char *>(&_status), sizeof(_status));
|
||||
auto addData = [&hash](auto p, size_t len) {
|
||||
hash.addData(QByteArrayView(reinterpret_cast<const char *>(p), len));
|
||||
};
|
||||
|
||||
addData(&_status, sizeof(_status));
|
||||
int len = _components.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
addData(&len, sizeof(len));
|
||||
for (const QmlDirParser::Component &component : _components) {
|
||||
len = component.fileName.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
hash.addData(reinterpret_cast<const char *>(component.fileName.constData()),
|
||||
len * sizeofQChar);
|
||||
hash.addData(reinterpret_cast<const char *>(&component.majorVersion), sizeof(component.majorVersion));
|
||||
hash.addData(reinterpret_cast<const char *>(&component.minorVersion), sizeof(component.minorVersion));
|
||||
addData(&len, sizeof(len));
|
||||
addData(component.fileName.constData(), len * sizeofQChar);
|
||||
addData(&component.majorVersion, sizeof(component.majorVersion));
|
||||
addData(&component.minorVersion, sizeof(component.minorVersion));
|
||||
len = component.typeName.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
hash.addData(reinterpret_cast<const char *>(component.typeName.constData()),
|
||||
component.typeName.size() * sizeofQChar);
|
||||
addData(&len, sizeof(len));
|
||||
addData(component.typeName.constData(), component.typeName.size() * sizeofQChar);
|
||||
int flags = (component.singleton ? (1 << 0) : 0) + (component.internal ? (1 << 1) : 0);
|
||||
hash.addData(reinterpret_cast<const char *>(&flags), sizeof(flags));
|
||||
addData(&flags, sizeof(flags));
|
||||
}
|
||||
len = _plugins.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
addData(&len, sizeof(len));
|
||||
for (const QmlDirParser::Plugin &plugin : _plugins) {
|
||||
len = plugin.path.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
hash.addData(reinterpret_cast<const char *>(plugin.path.constData()), len * sizeofQChar);
|
||||
addData(&len, sizeof(len));
|
||||
addData(plugin.path.constData(), len * sizeofQChar);
|
||||
len = plugin.name.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
hash.addData(reinterpret_cast<const char *>(plugin.name.constData()), len * sizeofQChar);
|
||||
addData(&len, sizeof(len));
|
||||
addData(plugin.name.constData(), len * sizeofQChar);
|
||||
}
|
||||
len = _typeinfos.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
addData(&len, sizeof(len));
|
||||
for (const QString &typeinfo : _typeinfos) {
|
||||
len = typeinfo.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
hash.addData(reinterpret_cast<const char *>(typeinfo.constData()),
|
||||
len * sizeofQChar);
|
||||
addData(&len, sizeof(len));
|
||||
addData(typeinfo.constData(), len * sizeofQChar);
|
||||
}
|
||||
len = _metaObjects.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
addData(&len, sizeof(len));
|
||||
QList<QByteArray> metaFingerprints;
|
||||
for (const LanguageUtils::FakeMetaObject::ConstPtr &metaObject : _metaObjects)
|
||||
metaFingerprints.append(metaObject->fingerprint());
|
||||
std::sort(metaFingerprints.begin(), metaFingerprints.end());
|
||||
for (const QByteArray &fp : std::as_const(metaFingerprints))
|
||||
hash.addData(fp);
|
||||
hash.addData(reinterpret_cast<const char *>(&_dumpStatus), sizeof(_dumpStatus));
|
||||
addData(&_dumpStatus, sizeof(_dumpStatus));
|
||||
len = _dumpError.size(); // localization dependent (avoid?)
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
hash.addData(reinterpret_cast<const char *>(_dumpError.constData()), len * sizeofQChar);
|
||||
addData(&len, sizeof(len));
|
||||
addData(_dumpError.constData(), len * sizeofQChar);
|
||||
|
||||
len = _moduleApis.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
addData(&len, sizeof(len));
|
||||
for (const ModuleApiInfo &moduleInfo : _moduleApis)
|
||||
moduleInfo.addToHash(hash); // make it order independent?
|
||||
|
||||
len = _imports.size();
|
||||
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
|
||||
addData(&len, sizeof(len));
|
||||
for (const QmlDirParser::Import &import : _imports)
|
||||
hash.addData(import.module.toUtf8()); // import order matters, keep order-dependent
|
||||
|
||||
|
||||
@@ -114,9 +114,9 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent)
|
||||
qRegisterMetaType<QmlJS::PathsAndLanguages>("QmlJS::PathsAndLanguages");
|
||||
|
||||
m_defaultProjectInfo.qtQmlPath =
|
||||
FilePath::fromUserInput(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath));
|
||||
FilePath::fromUserInput(QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath));
|
||||
m_defaultProjectInfo.qmllsPath = ModelManagerInterface::qmllsForBinPath(
|
||||
FilePath::fromUserInput(QLibraryInfo::location(QLibraryInfo::BinariesPath)),
|
||||
FilePath::fromUserInput(QLibraryInfo::path(QLibraryInfo::BinariesPath)),
|
||||
QLibraryInfo::version());
|
||||
m_defaultProjectInfo.qtVersionString = QLibraryInfo::version().toString();
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
add_qtc_library(Tasking OBJECT
|
||||
# Never add dependencies to non-Qt libraries for this library
|
||||
DEPENDS Qt::Core
|
||||
DEPENDS Qt::Concurrent Qt::Core Qt::Network
|
||||
PUBLIC_DEFINES TASKING_LIBRARY
|
||||
SOURCES
|
||||
barrier.cpp barrier.h
|
||||
concurrentcall.h
|
||||
networkquery.cpp networkquery.h
|
||||
tasking_global.h
|
||||
tasktree.cpp tasktree.h
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ private:
|
||||
int m_current = -1;
|
||||
};
|
||||
|
||||
class TASKING_EXPORT BarrierTaskAdapter : public Tasking::TaskAdapter<Barrier>
|
||||
class TASKING_EXPORT BarrierTaskAdapter : public TaskAdapter<Barrier>
|
||||
{
|
||||
public:
|
||||
BarrierTaskAdapter() { connect(task(), &Barrier::done, this, &TaskInterface::done); }
|
||||
|
||||
100
src/libs/solutions/tasking/concurrentcall.h
Normal file
@@ -0,0 +1,100 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tasking_global.h"
|
||||
|
||||
#include "tasktree.h"
|
||||
|
||||
#include <QtConcurrent>
|
||||
|
||||
namespace Tasking {
|
||||
|
||||
// This class introduces the dependency to Qt::Concurrent, otherwise Tasking namespace
|
||||
// is independent on Qt::Concurrent.
|
||||
// Possibly, it could be placed inside Qt::Concurrent library, as a wrapper around
|
||||
// QtConcurrent::run() call.
|
||||
|
||||
template <typename ResultType>
|
||||
class ConcurrentCall
|
||||
{
|
||||
Q_DISABLE_COPY_MOVE(ConcurrentCall)
|
||||
|
||||
public:
|
||||
ConcurrentCall() = default;
|
||||
template <typename Function, typename ...Args>
|
||||
void setConcurrentCallData(Function &&function, Args &&...args)
|
||||
{
|
||||
return wrapConcurrent(std::forward<Function>(function), std::forward<Args>(args)...);
|
||||
}
|
||||
void setThreadPool(QThreadPool *pool) { m_threadPool = pool; }
|
||||
ResultType result() const
|
||||
{
|
||||
return m_future.resultCount() ? m_future.result() : ResultType();
|
||||
}
|
||||
QFuture<ResultType> future() const { return m_future; }
|
||||
|
||||
private:
|
||||
template <typename Function, typename ...Args>
|
||||
void wrapConcurrent(Function &&function, Args &&...args)
|
||||
{
|
||||
m_startHandler = [=] {
|
||||
if (m_threadPool)
|
||||
return QtConcurrent::run(m_threadPool, function, args...);
|
||||
return QtConcurrent::run(function, args...);
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Function, typename ...Args>
|
||||
void wrapConcurrent(std::reference_wrapper<const Function> &&wrapper, Args &&...args)
|
||||
{
|
||||
m_startHandler = [=] {
|
||||
if (m_threadPool) {
|
||||
return QtConcurrent::run(m_threadPool,
|
||||
std::forward<const Function>(wrapper.get()), args...);
|
||||
}
|
||||
return QtConcurrent::run(std::forward<const Function>(wrapper.get()), args...);
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
friend class ConcurrentCallTaskAdapter;
|
||||
|
||||
std::function<QFuture<ResultType>()> m_startHandler;
|
||||
QThreadPool *m_threadPool = nullptr;
|
||||
QFuture<ResultType> m_future;
|
||||
};
|
||||
|
||||
template <typename ResultType>
|
||||
class ConcurrentCallTaskAdapter : public TaskAdapter<ConcurrentCall<ResultType>>
|
||||
{
|
||||
public:
|
||||
~ConcurrentCallTaskAdapter() {
|
||||
if (m_watcher) {
|
||||
m_watcher->cancel();
|
||||
m_watcher->waitForFinished();
|
||||
}
|
||||
}
|
||||
|
||||
void start() {
|
||||
if (!this->task()->m_startHandler) {
|
||||
emit this->done(false); // TODO: Add runtime assert
|
||||
return;
|
||||
}
|
||||
m_watcher.reset(new QFutureWatcher<ResultType>);
|
||||
this->connect(m_watcher.get(), &QFutureWatcherBase::finished, this, [this] {
|
||||
emit this->done(!m_watcher->isCanceled());
|
||||
m_watcher.release()->deleteLater();
|
||||
});
|
||||
this->task()->m_future = this->task()->m_startHandler();
|
||||
m_watcher->setFuture(this->task()->m_future);
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<QFutureWatcher<ResultType>> m_watcher;
|
||||
};
|
||||
|
||||
} // namespace Tasking
|
||||
|
||||
TASKING_DECLARE_TEMPLATE_TASK(ConcurrentCallTask, Tasking::ConcurrentCallTaskAdapter);
|
||||
38
src/libs/solutions/tasking/networkquery.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include "networkquery.h"
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
namespace Tasking {
|
||||
|
||||
void NetworkQuery::start()
|
||||
{
|
||||
if (m_reply) {
|
||||
qWarning("The NetworkQuery is already running. Ignoring the call to start().");
|
||||
return;
|
||||
}
|
||||
if (!m_manager) {
|
||||
qWarning("Can't start the NetworkQuery without the QNetworkAccessManager. "
|
||||
"Stopping with an error.");
|
||||
emit done(false);
|
||||
return;
|
||||
}
|
||||
m_reply.reset(m_manager->get(m_request));
|
||||
connect(m_reply.get(), &QNetworkReply::finished, this, [this] {
|
||||
disconnect(m_reply.get(), nullptr, this, nullptr);
|
||||
emit done(m_reply->error() == QNetworkReply::NoError);
|
||||
m_reply.release()->deleteLater();
|
||||
});
|
||||
if (m_reply->isRunning())
|
||||
emit started();
|
||||
}
|
||||
|
||||
NetworkQuery::~NetworkQuery()
|
||||
{
|
||||
if (m_reply)
|
||||
m_reply->abort();
|
||||
}
|
||||
|
||||
} // namespace Tasking
|
||||
55
src/libs/solutions/tasking/networkquery.h
Normal file
@@ -0,0 +1,55 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tasking_global.h"
|
||||
|
||||
#include "tasktree.h"
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include <memory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QNetworkAccessManager;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Tasking {
|
||||
|
||||
// This class introduces the dependency to Qt::Network, otherwise Tasking namespace
|
||||
// is independent on Qt::Network.
|
||||
// Possibly, it could be placed inside Qt::Network library, as a wrapper around QNetworkReply.
|
||||
|
||||
class TASKING_EXPORT NetworkQuery final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
~NetworkQuery();
|
||||
void setRequest(const QNetworkRequest &request) { m_request = request; }
|
||||
void setNetworkAccessManager(QNetworkAccessManager *manager) { m_manager = manager; }
|
||||
QNetworkReply *reply() const { return m_reply.get(); }
|
||||
void start();
|
||||
|
||||
signals:
|
||||
void started();
|
||||
void done(bool success);
|
||||
|
||||
private:
|
||||
QNetworkRequest m_request;
|
||||
QNetworkAccessManager *m_manager = nullptr;
|
||||
std::unique_ptr<QNetworkReply> m_reply;
|
||||
};
|
||||
|
||||
class TASKING_EXPORT NetworkQueryTaskAdapter : public TaskAdapter<NetworkQuery>
|
||||
{
|
||||
public:
|
||||
NetworkQueryTaskAdapter() { connect(task(), &NetworkQuery::done, this, &TaskInterface::done); }
|
||||
void start() final { task()->start(); }
|
||||
};
|
||||
|
||||
} // namespace Tasking
|
||||
|
||||
TASKING_DECLARE_TASK(NetworkQueryTask, Tasking::NetworkQueryTaskAdapter);
|
||||
@@ -1,11 +1,14 @@
|
||||
QtcLibrary {
|
||||
name: "Tasking"
|
||||
Depends { name: "Qt"; submodules: ["core"] }
|
||||
Depends { name: "Qt"; submodules: ["concurrent", "core", "network"] }
|
||||
cpp.defines: base.concat("TASKING_LIBRARY")
|
||||
|
||||
files: [
|
||||
"barrier.cpp",
|
||||
"barrier.h",
|
||||
"concurrentcall.h",
|
||||
"networkquery.cpp",
|
||||
"networkquery.h",
|
||||
"tasking_global.h",
|
||||
"tasktree.cpp",
|
||||
"tasktree.h",
|
||||
|
||||
@@ -43,11 +43,11 @@ private:
|
||||
};
|
||||
|
||||
/*!
|
||||
\class Tasking::TaskItem
|
||||
\class Tasking::GroupItem
|
||||
\inheaderfile solutions/tasking/tasktree.h
|
||||
\inmodule QtCreator
|
||||
\ingroup mainclasses
|
||||
\brief The TaskItem class represents the basic element for composing nested tree structures.
|
||||
\brief The GroupItem class represents the basic element for composing nested tree structures.
|
||||
*/
|
||||
|
||||
/*!
|
||||
@@ -246,7 +246,7 @@ private:
|
||||
*/
|
||||
|
||||
/*!
|
||||
\typealias TaskItem::GroupSetupHandler
|
||||
\typealias GroupItem::GroupSetupHandler
|
||||
|
||||
Type alias for \c std::function<TaskAction()>.
|
||||
|
||||
@@ -277,7 +277,7 @@ private:
|
||||
*/
|
||||
|
||||
/*!
|
||||
\typealias TaskItem::GroupEndHandler
|
||||
\typealias GroupItem::GroupEndHandler
|
||||
|
||||
Type alias for \c std::function\<void()\>.
|
||||
|
||||
@@ -290,13 +290,14 @@ private:
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <typename SetupHandler> TaskItem onGroupSetup(SetupHandler &&handler)
|
||||
\fn template <typename SetupHandler> GroupItem onGroupSetup(SetupHandler &&handler)
|
||||
|
||||
Constructs a group's element holding the group setup handler.
|
||||
The \a handler is invoked whenever the group starts.
|
||||
|
||||
The passed \a handler is either of \c std::function<TaskAction()> or \c std::function<void()>
|
||||
type. For more information on possible argument type, refer to \l {TaskItem::GroupSetupHandler}.
|
||||
type. For more information on possible argument type, refer to
|
||||
\l {GroupItem::GroupSetupHandler}.
|
||||
|
||||
When the \a handler is invoked, none of the group's child tasks are running yet.
|
||||
|
||||
@@ -304,7 +305,7 @@ private:
|
||||
after the storages are constructed, so that the \a handler may already
|
||||
perform some initial modifications to the active storages.
|
||||
|
||||
\sa TaskItem::GroupSetupHandler, onGroupDone, onGroupError
|
||||
\sa GroupItem::GroupSetupHandler, onGroupDone, onGroupError
|
||||
*/
|
||||
|
||||
/*!
|
||||
@@ -319,9 +320,9 @@ private:
|
||||
before the storages are destructed, so that the \a handler may still
|
||||
perform a last read of the active storages' data.
|
||||
|
||||
\sa TaskItem::GroupEndHandler, onGroupSetup, onGroupError
|
||||
\sa GroupItem::GroupEndHandler, onGroupSetup, onGroupError
|
||||
*/
|
||||
TaskItem onGroupDone(const TaskItem::GroupEndHandler &handler)
|
||||
GroupItem onGroupDone(const GroupItem::GroupEndHandler &handler)
|
||||
{
|
||||
return Group::onGroupDone(handler);
|
||||
}
|
||||
@@ -338,9 +339,9 @@ TaskItem onGroupDone(const TaskItem::GroupEndHandler &handler)
|
||||
before the storages are destructed, so that the \a handler may still
|
||||
perform a last read of the active storages' data.
|
||||
|
||||
\sa TaskItem::GroupEndHandler, onGroupSetup, onGroupDone
|
||||
\sa GroupItem::GroupEndHandler, onGroupSetup, onGroupDone
|
||||
*/
|
||||
TaskItem onGroupError(const TaskItem::GroupEndHandler &handler)
|
||||
GroupItem onGroupError(const GroupItem::GroupEndHandler &handler)
|
||||
{
|
||||
return Group::onGroupError(handler);
|
||||
}
|
||||
@@ -386,7 +387,7 @@ TaskItem onGroupError(const TaskItem::GroupEndHandler &handler)
|
||||
|
||||
\sa sequential, parallel
|
||||
*/
|
||||
TaskItem parallelLimit(int limit)
|
||||
GroupItem parallelLimit(int limit)
|
||||
{
|
||||
return Group::parallelLimit(qMax(limit, 0));
|
||||
}
|
||||
@@ -399,21 +400,21 @@ TaskItem parallelLimit(int limit)
|
||||
\sa stopOnError, continueOnError, stopOnDone, continueOnDone, stopOnFinished, finishAllAndDone,
|
||||
finishAllAndError, WorkflowPolicy
|
||||
*/
|
||||
TaskItem workflowPolicy(WorkflowPolicy policy)
|
||||
GroupItem workflowPolicy(WorkflowPolicy policy)
|
||||
{
|
||||
return Group::workflowPolicy(policy);
|
||||
}
|
||||
|
||||
const TaskItem sequential = parallelLimit(1);
|
||||
const TaskItem parallel = parallelLimit(0);
|
||||
const GroupItem sequential = parallelLimit(1);
|
||||
const GroupItem parallel = parallelLimit(0);
|
||||
|
||||
const TaskItem stopOnError = workflowPolicy(WorkflowPolicy::StopOnError);
|
||||
const TaskItem continueOnError = workflowPolicy(WorkflowPolicy::ContinueOnError);
|
||||
const TaskItem stopOnDone = workflowPolicy(WorkflowPolicy::StopOnDone);
|
||||
const TaskItem continueOnDone = workflowPolicy(WorkflowPolicy::ContinueOnDone);
|
||||
const TaskItem stopOnFinished = workflowPolicy(WorkflowPolicy::StopOnFinished);
|
||||
const TaskItem finishAllAndDone = workflowPolicy(WorkflowPolicy::FinishAllAndDone);
|
||||
const TaskItem finishAllAndError = workflowPolicy(WorkflowPolicy::FinishAllAndError);
|
||||
const GroupItem stopOnError = workflowPolicy(WorkflowPolicy::StopOnError);
|
||||
const GroupItem continueOnError = workflowPolicy(WorkflowPolicy::ContinueOnError);
|
||||
const GroupItem stopOnDone = workflowPolicy(WorkflowPolicy::StopOnDone);
|
||||
const GroupItem continueOnDone = workflowPolicy(WorkflowPolicy::ContinueOnDone);
|
||||
const GroupItem stopOnFinished = workflowPolicy(WorkflowPolicy::StopOnFinished);
|
||||
const GroupItem finishAllAndDone = workflowPolicy(WorkflowPolicy::FinishAllAndDone);
|
||||
const GroupItem finishAllAndError = workflowPolicy(WorkflowPolicy::FinishAllAndError);
|
||||
|
||||
static TaskAction toTaskAction(bool success)
|
||||
{
|
||||
@@ -483,11 +484,11 @@ void TreeStorageBase::activateStorage(int id) const
|
||||
m_storageData->m_activeStorage = id;
|
||||
}
|
||||
|
||||
void TaskItem::addChildren(const QList<TaskItem> &children)
|
||||
void GroupItem::addChildren(const QList<GroupItem> &children)
|
||||
{
|
||||
QTC_ASSERT(m_type == Type::Group, qWarning("Only Group may have children, skipping...");
|
||||
return);
|
||||
for (const TaskItem &child : children) {
|
||||
for (const GroupItem &child : children) {
|
||||
switch (child.m_type) {
|
||||
case Type::Group:
|
||||
m_children.append(child);
|
||||
@@ -534,7 +535,7 @@ void TaskItem::addChildren(const QList<TaskItem> &children)
|
||||
}
|
||||
}
|
||||
|
||||
void TaskItem::setTaskSetupHandler(const TaskSetupHandler &handler)
|
||||
void GroupItem::setTaskSetupHandler(const TaskSetupHandler &handler)
|
||||
{
|
||||
if (!handler) {
|
||||
qWarning("Setting empty Setup Handler is no-op, skipping...");
|
||||
@@ -545,7 +546,7 @@ void TaskItem::setTaskSetupHandler(const TaskSetupHandler &handler)
|
||||
m_taskHandler.m_setupHandler = handler;
|
||||
}
|
||||
|
||||
void TaskItem::setTaskDoneHandler(const TaskEndHandler &handler)
|
||||
void GroupItem::setTaskDoneHandler(const TaskEndHandler &handler)
|
||||
{
|
||||
if (!handler) {
|
||||
qWarning("Setting empty Done Handler is no-op, skipping...");
|
||||
@@ -556,7 +557,7 @@ void TaskItem::setTaskDoneHandler(const TaskEndHandler &handler)
|
||||
m_taskHandler.m_doneHandler = handler;
|
||||
}
|
||||
|
||||
void TaskItem::setTaskErrorHandler(const TaskEndHandler &handler)
|
||||
void GroupItem::setTaskErrorHandler(const TaskEndHandler &handler)
|
||||
{
|
||||
if (!handler) {
|
||||
qWarning("Setting empty Error Handler is no-op, skipping...");
|
||||
@@ -567,7 +568,7 @@ void TaskItem::setTaskErrorHandler(const TaskEndHandler &handler)
|
||||
m_taskHandler.m_errorHandler = handler;
|
||||
}
|
||||
|
||||
TaskItem TaskItem::withTimeout(const TaskItem &item, milliseconds timeout,
|
||||
GroupItem GroupItem::withTimeout(const GroupItem &item, milliseconds timeout,
|
||||
const GroupEndHandler &handler)
|
||||
{
|
||||
const TimeoutTask::EndHandler taskHandler = handler
|
||||
@@ -640,7 +641,7 @@ class TaskContainer
|
||||
Q_DISABLE_COPY_MOVE(TaskContainer)
|
||||
|
||||
public:
|
||||
TaskContainer(TaskTreePrivate *taskTreePrivate, const TaskItem &task,
|
||||
TaskContainer(TaskTreePrivate *taskTreePrivate, const GroupItem &task,
|
||||
TaskNode *parentNode, TaskContainer *parentContainer)
|
||||
: m_constData(taskTreePrivate, task, parentNode, parentContainer, this) {}
|
||||
TaskAction start();
|
||||
@@ -653,7 +654,7 @@ public:
|
||||
bool isStarting() const { return isRunning() && m_runtimeData->m_startGuard.isLocked(); }
|
||||
|
||||
struct ConstData {
|
||||
ConstData(TaskTreePrivate *taskTreePrivate, const TaskItem &task, TaskNode *parentNode,
|
||||
ConstData(TaskTreePrivate *taskTreePrivate, const GroupItem &task, TaskNode *parentNode,
|
||||
TaskContainer *parentContainer, TaskContainer *thisContainer);
|
||||
~ConstData() { qDeleteAll(m_children); }
|
||||
TaskTreePrivate * const m_taskTreePrivate = nullptr;
|
||||
@@ -662,7 +663,7 @@ public:
|
||||
|
||||
const int m_parallelLimit = 1;
|
||||
const WorkflowPolicy m_workflowPolicy = WorkflowPolicy::StopOnError;
|
||||
const TaskItem::GroupHandler m_groupHandler;
|
||||
const GroupItem::GroupHandler m_groupHandler;
|
||||
const QList<TreeStorageBase> m_storageList;
|
||||
const QList<TaskNode *> m_children;
|
||||
const int m_taskCount = 0;
|
||||
@@ -693,7 +694,7 @@ class TaskNode
|
||||
Q_DISABLE_COPY_MOVE(TaskNode)
|
||||
|
||||
public:
|
||||
TaskNode(TaskTreePrivate *taskTreePrivate, const TaskItem &task,
|
||||
TaskNode(TaskTreePrivate *taskTreePrivate, const GroupItem &task,
|
||||
TaskContainer *parentContainer)
|
||||
: m_taskHandler(task.taskHandler())
|
||||
, m_container(taskTreePrivate, task, this, parentContainer)
|
||||
@@ -711,7 +712,7 @@ public:
|
||||
TaskTree *taskTree() const { return m_container.m_constData.m_taskTreePrivate->q; }
|
||||
|
||||
private:
|
||||
const TaskItem::TaskHandler m_taskHandler;
|
||||
const GroupItem::TaskHandler m_taskHandler;
|
||||
TaskContainer m_container;
|
||||
std::unique_ptr<TaskInterface> m_task;
|
||||
};
|
||||
@@ -831,16 +832,16 @@ ReturnType invokeHandler(TaskContainer *container, Handler &&handler, Args &&...
|
||||
}
|
||||
|
||||
static QList<TaskNode *> createChildren(TaskTreePrivate *taskTreePrivate, TaskContainer *container,
|
||||
const TaskItem &task)
|
||||
const GroupItem &task)
|
||||
{
|
||||
QList<TaskNode *> result;
|
||||
const QList<TaskItem> &children = task.children();
|
||||
for (const TaskItem &child : children)
|
||||
const QList<GroupItem> &children = task.children();
|
||||
for (const GroupItem &child : children)
|
||||
result.append(new TaskNode(taskTreePrivate, child, container));
|
||||
return result;
|
||||
}
|
||||
|
||||
TaskContainer::ConstData::ConstData(TaskTreePrivate *taskTreePrivate, const TaskItem &task,
|
||||
TaskContainer::ConstData::ConstData(TaskTreePrivate *taskTreePrivate, const GroupItem &task,
|
||||
TaskNode *parentNode, TaskContainer *parentContainer,
|
||||
TaskContainer *thisContainer)
|
||||
: m_taskTreePrivate(taskTreePrivate)
|
||||
@@ -1035,7 +1036,7 @@ void TaskContainer::stop()
|
||||
|
||||
void TaskContainer::invokeEndHandler()
|
||||
{
|
||||
const TaskItem::GroupHandler &groupHandler = m_constData.m_groupHandler;
|
||||
const GroupItem::GroupHandler &groupHandler = m_constData.m_groupHandler;
|
||||
if (m_runtimeData->m_successBit && groupHandler.m_doneHandler)
|
||||
invokeHandler(this, groupHandler.m_doneHandler);
|
||||
else if (!m_runtimeData->m_successBit && groupHandler.m_errorHandler)
|
||||
@@ -1539,7 +1540,7 @@ void TaskNode::invokeEndHandler(bool success)
|
||||
static QByteArray load(const QString &fileName) { ... }
|
||||
static void save(const QString &fileName, const QByteArray &array) { ... }
|
||||
|
||||
static TaskItem copyRecipe(const QString &source, const QString &destination)
|
||||
static GroupItem copyRecipe(const QString &source, const QString &destination)
|
||||
{
|
||||
struct CopyStorage { // [1] custom inter-task struct
|
||||
QByteArray content; // [2] custom inter-task data
|
||||
|
||||
@@ -123,7 +123,7 @@ enum class TaskAction
|
||||
};
|
||||
Q_ENUM_NS(TaskAction);
|
||||
|
||||
class TASKING_EXPORT TaskItem
|
||||
class TASKING_EXPORT GroupItem
|
||||
{
|
||||
public:
|
||||
// Internal, provided by QTC_DECLARE_CUSTOM_TASK
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
std::optional<WorkflowPolicy> m_workflowPolicy = {};
|
||||
};
|
||||
|
||||
QList<TaskItem> children() const { return m_children; }
|
||||
QList<GroupItem> children() const { return m_children; }
|
||||
GroupData groupData() const { return m_groupData; }
|
||||
QList<TreeStorageBase> storageList() const { return m_storageList; }
|
||||
TaskHandler taskHandler() const { return m_taskHandler; }
|
||||
@@ -169,58 +169,58 @@ protected:
|
||||
TaskHandler
|
||||
};
|
||||
|
||||
TaskItem() = default;
|
||||
TaskItem(const GroupData &data)
|
||||
GroupItem() = default;
|
||||
GroupItem(const GroupData &data)
|
||||
: m_type(Type::GroupData)
|
||||
, m_groupData(data) {}
|
||||
TaskItem(const TreeStorageBase &storage)
|
||||
GroupItem(const TreeStorageBase &storage)
|
||||
: m_type(Type::Storage)
|
||||
, m_storageList{storage} {}
|
||||
TaskItem(const TaskHandler &handler)
|
||||
GroupItem(const TaskHandler &handler)
|
||||
: m_type(Type::TaskHandler)
|
||||
, m_taskHandler(handler) {}
|
||||
void addChildren(const QList<TaskItem> &children);
|
||||
void addChildren(const QList<GroupItem> &children);
|
||||
|
||||
void setTaskSetupHandler(const TaskSetupHandler &handler);
|
||||
void setTaskDoneHandler(const TaskEndHandler &handler);
|
||||
void setTaskErrorHandler(const TaskEndHandler &handler);
|
||||
static TaskItem groupHandler(const GroupHandler &handler) { return TaskItem({handler}); }
|
||||
static TaskItem parallelLimit(int limit) { return TaskItem({{}, limit}); }
|
||||
static TaskItem workflowPolicy(WorkflowPolicy policy) { return TaskItem({{}, {}, policy}); }
|
||||
static TaskItem withTimeout(const TaskItem &item, std::chrono::milliseconds timeout,
|
||||
static GroupItem groupHandler(const GroupHandler &handler) { return GroupItem({handler}); }
|
||||
static GroupItem parallelLimit(int limit) { return GroupItem({{}, limit}); }
|
||||
static GroupItem workflowPolicy(WorkflowPolicy policy) { return GroupItem({{}, {}, policy}); }
|
||||
static GroupItem withTimeout(const GroupItem &item, std::chrono::milliseconds timeout,
|
||||
const GroupEndHandler &handler = {});
|
||||
|
||||
private:
|
||||
Type m_type = Type::Group;
|
||||
QList<TaskItem> m_children;
|
||||
QList<GroupItem> m_children;
|
||||
GroupData m_groupData;
|
||||
QList<TreeStorageBase> m_storageList;
|
||||
TaskHandler m_taskHandler;
|
||||
};
|
||||
|
||||
class TASKING_EXPORT Group : public TaskItem
|
||||
class TASKING_EXPORT Group : public GroupItem
|
||||
{
|
||||
public:
|
||||
Group(const QList<TaskItem> &children) { addChildren(children); }
|
||||
Group(std::initializer_list<TaskItem> children) { addChildren(children); }
|
||||
Group(const QList<GroupItem> &children) { addChildren(children); }
|
||||
Group(std::initializer_list<GroupItem> children) { addChildren(children); }
|
||||
|
||||
// GroupData related:
|
||||
template <typename SetupHandler>
|
||||
static TaskItem onGroupSetup(SetupHandler &&handler) {
|
||||
static GroupItem onGroupSetup(SetupHandler &&handler) {
|
||||
return groupHandler({wrapGroupSetup(std::forward<SetupHandler>(handler))});
|
||||
}
|
||||
static TaskItem onGroupDone(const GroupEndHandler &handler) {
|
||||
static GroupItem onGroupDone(const GroupEndHandler &handler) {
|
||||
return groupHandler({{}, handler});
|
||||
}
|
||||
static TaskItem onGroupError(const GroupEndHandler &handler) {
|
||||
static GroupItem onGroupError(const GroupEndHandler &handler) {
|
||||
return groupHandler({{}, {}, handler});
|
||||
}
|
||||
using TaskItem::parallelLimit; // Default: 1 (sequential). 0 means unlimited (parallel).
|
||||
using TaskItem::workflowPolicy; // Default: WorkflowPolicy::StopOnError.
|
||||
using GroupItem::parallelLimit; // Default: 1 (sequential). 0 means unlimited (parallel).
|
||||
using GroupItem::workflowPolicy; // Default: WorkflowPolicy::StopOnError.
|
||||
|
||||
TaskItem withTimeout(std::chrono::milliseconds timeout,
|
||||
GroupItem withTimeout(std::chrono::milliseconds timeout,
|
||||
const GroupEndHandler &handler = {}) const {
|
||||
return TaskItem::withTimeout(*this, timeout, handler);
|
||||
return GroupItem::withTimeout(*this, timeout, handler);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -244,31 +244,31 @@ private:
|
||||
};
|
||||
|
||||
template <typename SetupHandler>
|
||||
static TaskItem onGroupSetup(SetupHandler &&handler)
|
||||
static GroupItem onGroupSetup(SetupHandler &&handler)
|
||||
{
|
||||
return Group::onGroupSetup(std::forward<SetupHandler>(handler));
|
||||
}
|
||||
|
||||
TASKING_EXPORT TaskItem onGroupDone(const TaskItem::GroupEndHandler &handler);
|
||||
TASKING_EXPORT TaskItem onGroupError(const TaskItem::GroupEndHandler &handler);
|
||||
TASKING_EXPORT TaskItem parallelLimit(int limit);
|
||||
TASKING_EXPORT TaskItem workflowPolicy(WorkflowPolicy policy);
|
||||
TASKING_EXPORT GroupItem onGroupDone(const GroupItem::GroupEndHandler &handler);
|
||||
TASKING_EXPORT GroupItem onGroupError(const GroupItem::GroupEndHandler &handler);
|
||||
TASKING_EXPORT GroupItem parallelLimit(int limit);
|
||||
TASKING_EXPORT GroupItem workflowPolicy(WorkflowPolicy policy);
|
||||
|
||||
TASKING_EXPORT extern const TaskItem sequential;
|
||||
TASKING_EXPORT extern const TaskItem parallel;
|
||||
TASKING_EXPORT extern const GroupItem sequential;
|
||||
TASKING_EXPORT extern const GroupItem parallel;
|
||||
|
||||
TASKING_EXPORT extern const TaskItem stopOnError;
|
||||
TASKING_EXPORT extern const TaskItem continueOnError;
|
||||
TASKING_EXPORT extern const TaskItem stopOnDone;
|
||||
TASKING_EXPORT extern const TaskItem continueOnDone;
|
||||
TASKING_EXPORT extern const TaskItem stopOnFinished;
|
||||
TASKING_EXPORT extern const TaskItem finishAllAndDone;
|
||||
TASKING_EXPORT extern const TaskItem finishAllAndError;
|
||||
TASKING_EXPORT extern const GroupItem stopOnError;
|
||||
TASKING_EXPORT extern const GroupItem continueOnError;
|
||||
TASKING_EXPORT extern const GroupItem stopOnDone;
|
||||
TASKING_EXPORT extern const GroupItem continueOnDone;
|
||||
TASKING_EXPORT extern const GroupItem stopOnFinished;
|
||||
TASKING_EXPORT extern const GroupItem finishAllAndDone;
|
||||
TASKING_EXPORT extern const GroupItem finishAllAndError;
|
||||
|
||||
class TASKING_EXPORT Storage : public TaskItem
|
||||
class TASKING_EXPORT Storage : public GroupItem
|
||||
{
|
||||
public:
|
||||
Storage(const TreeStorageBase &storage) : TaskItem(storage) { }
|
||||
Storage(const TreeStorageBase &storage) : GroupItem(storage) { }
|
||||
};
|
||||
|
||||
// Synchronous invocation. Similarly to Group - isn't counted as a task inside taskCount()
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
|
||||
private:
|
||||
template<typename Function>
|
||||
static QList<TaskItem> init(Function &&function) {
|
||||
static QList<GroupItem> init(Function &&function) {
|
||||
constexpr bool isInvocable = std::is_invocable_v<std::decay_t<Function>>;
|
||||
static_assert(isInvocable,
|
||||
"Sync element: The synchronous function can't take any arguments.");
|
||||
@@ -310,16 +310,16 @@ private:
|
||||
};
|
||||
|
||||
template <typename Adapter>
|
||||
class CustomTask : public TaskItem
|
||||
class CustomTask : public GroupItem
|
||||
{
|
||||
public:
|
||||
using Task = typename Adapter::Type;
|
||||
using EndHandler = std::function<void(const Task &)>;
|
||||
static Adapter *createAdapter() { return new Adapter; }
|
||||
CustomTask() : TaskItem({&createAdapter}) {}
|
||||
CustomTask() : GroupItem({&createAdapter}) {}
|
||||
template <typename SetupFunction>
|
||||
CustomTask(SetupFunction &&function, const EndHandler &done = {}, const EndHandler &error = {})
|
||||
: TaskItem({&createAdapter, wrapSetup(std::forward<SetupFunction>(function)),
|
||||
: GroupItem({&createAdapter, wrapSetup(std::forward<SetupFunction>(function)),
|
||||
wrapEnd(done), wrapEnd(error)}) {}
|
||||
|
||||
template <typename SetupFunction>
|
||||
@@ -336,14 +336,14 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
TaskItem withTimeout(std::chrono::milliseconds timeout,
|
||||
GroupItem withTimeout(std::chrono::milliseconds timeout,
|
||||
const GroupEndHandler &handler = {}) const {
|
||||
return TaskItem::withTimeout(*this, timeout, handler);
|
||||
return GroupItem::withTimeout(*this, timeout, handler);
|
||||
}
|
||||
|
||||
private:
|
||||
template<typename SetupFunction>
|
||||
static TaskItem::TaskSetupHandler wrapSetup(SetupFunction &&function) {
|
||||
static GroupItem::TaskSetupHandler wrapSetup(SetupFunction &&function) {
|
||||
static constexpr bool isDynamic = std::is_same_v<TaskAction,
|
||||
std::invoke_result_t<std::decay_t<SetupFunction>, typename Adapter::Type &>>;
|
||||
constexpr bool isVoid = std::is_same_v<void,
|
||||
|
||||
@@ -2320,7 +2320,7 @@ QList<int> IntegersAspect::value() const
|
||||
|
||||
void IntegersAspect::setValue(const QList<int> &value)
|
||||
{
|
||||
BaseAspect::setValue(transform(value, &QVariant::fromValue<int>));
|
||||
BaseAspect::setValue(transform(value, [](int i) { return QVariant::fromValue<int>(i); }));
|
||||
}
|
||||
|
||||
QList<int> IntegersAspect::defaultValue() const
|
||||
@@ -2331,7 +2331,7 @@ QList<int> IntegersAspect::defaultValue() const
|
||||
|
||||
void IntegersAspect::setDefaultValue(const QList<int> &value)
|
||||
{
|
||||
BaseAspect::setDefaultValue(transform(value, &QVariant::fromValue<int>));
|
||||
BaseAspect::setDefaultValue(transform(value, [](int i) { return QVariant::fromValue<int>(i); }));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ FilePath BuildableHelperLibrary::qtChooserToQmakePath(const FilePath &qtChooser)
|
||||
int pos = output.indexOf(toolDir);
|
||||
if (pos == -1)
|
||||
return {};
|
||||
pos += toolDir.count();
|
||||
pos += toolDir.size();
|
||||
int end = output.indexOf('\"', pos);
|
||||
if (end == -1)
|
||||
return {};
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
void start() {
|
||||
QTC_ASSERT(!m_taskTree, return);
|
||||
|
||||
const TaskItem task = m_filePath.needsDevice() ? remoteTask() : localTask();
|
||||
const GroupItem task = m_filePath.needsDevice() ? remoteTask() : localTask();
|
||||
m_taskTree.reset(new TaskTree({task}));
|
||||
const auto finalize = [this](bool success) {
|
||||
m_taskTree.release()->deleteLater();
|
||||
@@ -49,8 +49,8 @@ protected:
|
||||
std::unique_ptr<TaskTree> m_taskTree;
|
||||
|
||||
private:
|
||||
virtual TaskItem remoteTask() = 0;
|
||||
virtual TaskItem localTask() = 0;
|
||||
virtual GroupItem remoteTask() = 0;
|
||||
virtual GroupItem localTask() = 0;
|
||||
};
|
||||
|
||||
static void localRead(QPromise<QByteArray> &promise, const FilePath &filePath)
|
||||
@@ -84,7 +84,7 @@ signals:
|
||||
void readyRead(const QByteArray &newData);
|
||||
|
||||
private:
|
||||
TaskItem remoteTask() final {
|
||||
GroupItem remoteTask() final {
|
||||
const auto setup = [this](Process &process) {
|
||||
const QStringList args = {"if=" + m_filePath.path()};
|
||||
const FilePath dd = m_filePath.withNewPath("dd");
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
};
|
||||
return ProcessTask(setup);
|
||||
}
|
||||
TaskItem localTask() final {
|
||||
GroupItem localTask() final {
|
||||
const auto setup = [this](Async<QByteArray> &async) {
|
||||
async.setConcurrentCallData(localRead, m_filePath);
|
||||
Async<QByteArray> *asyncPtr = &async;
|
||||
@@ -251,7 +251,7 @@ signals:
|
||||
void started();
|
||||
|
||||
private:
|
||||
TaskItem remoteTask() final {
|
||||
GroupItem remoteTask() final {
|
||||
const auto setup = [this](Process &process) {
|
||||
m_writeBuffer = new WriteBuffer(false, &process);
|
||||
connect(m_writeBuffer, &WriteBuffer::writeRequested, &process, &Process::writeRaw);
|
||||
@@ -272,7 +272,7 @@ private:
|
||||
};
|
||||
return ProcessTask(setup, finalize, finalize);
|
||||
}
|
||||
TaskItem localTask() final {
|
||||
GroupItem localTask() final {
|
||||
const auto setup = [this](Async<void> &async) {
|
||||
m_writeBuffer = new WriteBuffer(isBuffered(), &async);
|
||||
async.setConcurrentCallData(localWrite, m_filePath, m_writeData, m_writeBuffer);
|
||||
@@ -390,7 +390,7 @@ public:
|
||||
StreamResult m_streamResult = StreamResult::FinishedWithError;
|
||||
std::unique_ptr<TaskTree> m_taskTree;
|
||||
|
||||
TaskItem task() {
|
||||
GroupItem task() {
|
||||
if (m_streamerMode == StreamMode::Reader)
|
||||
return readerTask();
|
||||
if (m_streamerMode == StreamMode::Writer)
|
||||
@@ -399,7 +399,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
TaskItem readerTask() {
|
||||
GroupItem readerTask() {
|
||||
const auto setup = [this](FileStreamReader &reader) {
|
||||
m_readBuffer.clear();
|
||||
reader.setFilePath(m_source);
|
||||
@@ -409,14 +409,14 @@ private:
|
||||
};
|
||||
return FileStreamReaderTask(setup);
|
||||
}
|
||||
TaskItem writerTask() {
|
||||
GroupItem writerTask() {
|
||||
const auto setup = [this](FileStreamWriter &writer) {
|
||||
writer.setFilePath(m_destination);
|
||||
writer.setWriteData(m_writeBuffer);
|
||||
};
|
||||
return FileStreamWriterTask(setup);
|
||||
}
|
||||
TaskItem transferTask() {
|
||||
GroupItem transferTask() {
|
||||
const auto setup = [this](Async<void> &async) {
|
||||
async.setConcurrentCallData(transfer, m_source, m_destination);
|
||||
};
|
||||
|
||||
@@ -133,7 +133,7 @@ bool FileSaverBase::write(const QByteArray &bytes)
|
||||
{
|
||||
if (m_hasError)
|
||||
return false;
|
||||
return setResult(m_file->write(bytes) == bytes.count());
|
||||
return setResult(m_file->write(bytes) == bytes.size());
|
||||
}
|
||||
|
||||
bool FileSaverBase::setResult(bool ok)
|
||||
|
||||
@@ -676,24 +676,22 @@ LayoutItem st()
|
||||
|
||||
LayoutItem noMargin()
|
||||
{
|
||||
LayoutItem item;
|
||||
item.onAdd = [](LayoutBuilder &builder) {
|
||||
if (auto layout = builder.stack.last().layout)
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
else if (auto widget = builder.stack.last().widget)
|
||||
widget->setContentsMargins(0, 0, 0, 0);
|
||||
};
|
||||
return item;
|
||||
return customMargin({});
|
||||
}
|
||||
|
||||
LayoutItem normalMargin()
|
||||
{
|
||||
return customMargin({9, 9, 9, 9});
|
||||
}
|
||||
|
||||
LayoutItem customMargin(const QMargins &margin)
|
||||
{
|
||||
LayoutItem item;
|
||||
item.onAdd = [](LayoutBuilder &builder) {
|
||||
item.onAdd = [margin](LayoutBuilder &builder) {
|
||||
if (auto layout = builder.stack.last().layout)
|
||||
layout->setContentsMargins(9, 9, 9, 9);
|
||||
layout->setContentsMargins(margin);
|
||||
else if (auto widget = builder.stack.last().widget)
|
||||
widget->setContentsMargins(9, 9, 9, 9);
|
||||
widget->setContentsMargins(margin);
|
||||
};
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLayout;
|
||||
class QMargins;
|
||||
class QObject;
|
||||
class QWidget;
|
||||
template <class T> T qobject_cast(QObject *object);
|
||||
@@ -202,6 +203,7 @@ QTCREATOR_UTILS_EXPORT LayoutItem empty();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem hr();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem noMargin();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem normalMargin();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem customMargin(const QMargins &margin);
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem withFormAlignment();
|
||||
|
||||
// "Setters"
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
MacroExpander::PrefixFunction pf = it.value();
|
||||
if (found)
|
||||
*found = true;
|
||||
return pf(QString::fromUtf8(variable.mid(it.key().count())));
|
||||
return pf(QString::fromUtf8(variable.mid(it.key().size())));
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
|
||||
@@ -4,13 +4,9 @@
|
||||
#include "networkaccessmanager.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QLibraryInfo>
|
||||
#include <QLocale>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
#include <QSysInfo>
|
||||
|
||||
/*!
|
||||
\class Utils::NetworkAccessManager
|
||||
@@ -75,5 +71,4 @@ QNetworkReply* NetworkAccessManager::createRequest(Operation op, const QNetworkR
|
||||
return QNetworkAccessManager::createRequest(op, req, outgoingData);
|
||||
}
|
||||
|
||||
|
||||
} // namespace utils
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QUrl;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT NetworkAccessManager : public QNetworkAccessManager
|
||||
|
||||
@@ -134,7 +134,7 @@ private:
|
||||
}
|
||||
static QString formatField(int number, int fieldWidth, const QString &suffix = {})
|
||||
{
|
||||
return QString("%1%2").arg(number, fieldWidth - suffix.count()).arg(suffix);
|
||||
return QString("%1%2").arg(number, fieldWidth - suffix.size()).arg(suffix);
|
||||
}
|
||||
|
||||
static int toMs(quint64 nsesc) // nanoseconds to miliseconds
|
||||
|
||||
@@ -35,7 +35,7 @@ using namespace ProjectExplorer;
|
||||
static bool isProjectParsing()
|
||||
{
|
||||
const BuildSystem *bs = ProjectManager::startupBuildSystem();
|
||||
return bs && bs->isParsing();
|
||||
return bs && (bs->isParsing() || bs->isWaitingForParse());
|
||||
}
|
||||
|
||||
TestCodeParser::TestCodeParser()
|
||||
@@ -360,7 +360,7 @@ void TestCodeParser::scanForTests(const QSet<FilePath> &filePaths,
|
||||
|
||||
using namespace Tasking;
|
||||
|
||||
QList<TaskItem> tasks{parallelLimit(std::max(QThread::idealThreadCount() / 4, 1))};
|
||||
QList<GroupItem> tasks{parallelLimit(std::max(QThread::idealThreadCount() / 4, 1))};
|
||||
for (const FilePath &file : filteredFiles) {
|
||||
const auto setup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
|
||||
async.setConcurrentCallData(parseFileForTests, codeParsers, file);
|
||||
|
||||
@@ -347,7 +347,7 @@ void TestRunner::runTestsHelper()
|
||||
std::unique_ptr<TestOutputReader> m_outputReader;
|
||||
};
|
||||
|
||||
QList<TaskItem> tasks{finishAllAndDone};
|
||||
QList<GroupItem> tasks{finishAllAndDone};
|
||||
|
||||
for (ITestConfiguration *config : m_selectedTests) {
|
||||
QTC_ASSERT(config, continue);
|
||||
|
||||
@@ -56,6 +56,7 @@ GeneralSettings::GeneralSettings()
|
||||
st
|
||||
};
|
||||
});
|
||||
readSettings();
|
||||
}
|
||||
|
||||
QList<MimeType> GeneralSettings::allowedMimeTypes() const
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/session.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
|
||||
#include <cppeditor/cppcodemodelsettings.h>
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
@@ -686,6 +687,7 @@ void ClangModelManagerSupport::claimNonProjectSources(ClangdClient *client)
|
||||
// for the respective project to force re-parsing of open documents and re-indexing.
|
||||
// While this is not 100% bullet-proof, chances are good that in a typical session-based
|
||||
// workflow, e.g. a git branch switch will hit at least one open file.
|
||||
// We also look for repository changes explicitly.
|
||||
void ClangModelManagerSupport::watchForExternalChanges()
|
||||
{
|
||||
connect(DocumentManager::instance(), &DocumentManager::filesChangedExternally,
|
||||
@@ -709,6 +711,23 @@ void ClangModelManagerSupport::watchForExternalChanges()
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
connect(VcsManager::instance(), &VcsManager::repositoryChanged,
|
||||
this, [this](const FilePath &repoDir) {
|
||||
if (sessionModeEnabled()) {
|
||||
if (ClangdClient * const client = clientForProject(nullptr))
|
||||
scheduleClientRestart(client);
|
||||
return;
|
||||
}
|
||||
for (const Project * const project : ProjectManager::projects()) {
|
||||
const FilePath &projectDir = project->projectDirectory();
|
||||
if (repoDir == projectDir || repoDir.isChildOf(projectDir)
|
||||
|| projectDir.isChildOf(repoDir)) {
|
||||
if (ClangdClient * const client = clientForProject(project))
|
||||
scheduleClientRestart(client);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// If Qt Creator changes a file that is not open (e.g. as part of a quickfix), we have to
|
||||
|
||||
@@ -158,8 +158,6 @@ CppEditor::CppCodeStyleSettings ClangFormatFile::toCppCodeStyleSettings(
|
||||
settings.indentSwitchLabels = style.IndentCaseLabels;
|
||||
#if LLVM_VERSION_MAJOR >= 11
|
||||
settings.indentBlocksRelativeToSwitchLabels = style.IndentCaseBlocks;
|
||||
settings.indentStatementsRelativeToSwitchLabels = style.IndentCaseBlocks;
|
||||
settings.indentControlFlowRelativeToSwitchLabels = style.IndentCaseBlocks;
|
||||
#endif
|
||||
if (style.DerivePointerAlignment
|
||||
&& ClangFormatSettings::instance().mode() == ClangFormatSettings::Mode::Formatting) {
|
||||
@@ -200,9 +198,7 @@ void ClangFormatFile::fromCppCodeStyleSettings(const CppEditor::CppCodeStyleSett
|
||||
|
||||
m_style.IndentCaseLabels = settings.indentSwitchLabels;
|
||||
#if LLVM_VERSION_MAJOR >= 11
|
||||
m_style.IndentCaseBlocks = settings.indentBlocksRelativeToSwitchLabels
|
||||
|| settings.indentStatementsRelativeToSwitchLabels
|
||||
|| settings.indentControlFlowRelativeToSwitchLabels;
|
||||
m_style.IndentCaseBlocks = settings.indentBlocksRelativeToSwitchLabels;
|
||||
#endif
|
||||
|
||||
if (settings.extraPaddingForConditionsIfConfusingAlign)
|
||||
|
||||
@@ -183,7 +183,7 @@ void ClangToolRunWorker::start()
|
||||
m_filesAnalyzed.clear();
|
||||
m_filesNotAnalyzed.clear();
|
||||
|
||||
QList<TaskItem> tasks{parallelLimit(qMax(1, m_runSettings.parallelJobs()))};
|
||||
QList<GroupItem> tasks{parallelLimit(qMax(1, m_runSettings.parallelJobs()))};
|
||||
for (const AnalyzeUnit &unit : std::as_const(unitsToProcess)) {
|
||||
if (!m_diagnosticConfig.isEnabled(tool)
|
||||
&& !m_runSettings.hasConfigFileForSourceFile(unit.file)) {
|
||||
|
||||
@@ -101,7 +101,7 @@ static FilePath createOutputFilePath(const FilePath &dirPath, const FilePath &fi
|
||||
return {};
|
||||
}
|
||||
|
||||
TaskItem clangToolTask(const AnalyzeInputData &input,
|
||||
GroupItem clangToolTask(const AnalyzeInputData &input,
|
||||
const AnalyzeSetupHandler &setupHandler,
|
||||
const AnalyzeOutputHandler &outputHandler)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
namespace Tasking { class TaskItem; }
|
||||
namespace Tasking { class GroupItem; }
|
||||
|
||||
namespace ClangTools {
|
||||
namespace Internal {
|
||||
@@ -50,7 +50,7 @@ struct AnalyzeOutputData
|
||||
using AnalyzeSetupHandler = std::function<bool()>;
|
||||
using AnalyzeOutputHandler = std::function<void(const AnalyzeOutputData &)>;
|
||||
|
||||
Tasking::TaskItem clangToolTask(const AnalyzeInputData &input,
|
||||
Tasking::GroupItem clangToolTask(const AnalyzeInputData &input,
|
||||
const AnalyzeSetupHandler &setupHandler,
|
||||
const AnalyzeOutputHandler &outputHandler);
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QSignalSpy>
|
||||
|
||||
@@ -190,7 +190,7 @@ void DocumentClangToolRunner::run()
|
||||
vfso().update();
|
||||
const ClangDiagnosticConfig config = diagnosticConfig(runSettings.diagnosticConfigId());
|
||||
const Environment env = projectBuildEnvironment(project);
|
||||
QList<TaskItem> tasks{parallel};
|
||||
QList<GroupItem> tasks{parallel};
|
||||
const auto addClangTool = [this, &runSettings, &config, &env, &tasks](ClangToolType tool) {
|
||||
if (!toolEnabled(tool, config, runSettings))
|
||||
return;
|
||||
|
||||
@@ -272,10 +272,10 @@ CMakeConfigItem CMakeConfigItem::fromString(const QString &s)
|
||||
|
||||
static QByteArray trimCMakeCacheLine(const QByteArray &in) {
|
||||
int start = 0;
|
||||
while (start < in.count() && (in.at(start) == ' ' || in.at(start) == '\t'))
|
||||
while (start < in.size() && (in.at(start) == ' ' || in.at(start) == '\t'))
|
||||
++start;
|
||||
|
||||
return in.mid(start, in.count() - start - 1);
|
||||
return in.mid(start, in.size() - start - 1);
|
||||
}
|
||||
|
||||
static QByteArrayList splitCMakeCacheLine(const QByteArray &line) {
|
||||
@@ -377,9 +377,9 @@ CMakeConfig CMakeConfig::fromFile(const Utils::FilePath &cacheFile, QString *err
|
||||
const QByteArray value = pieces.at(2);
|
||||
|
||||
if (key.endsWith("-ADVANCED") && value == "1") {
|
||||
advancedSet.insert(key.left(key.count() - 9 /* "-ADVANCED" */));
|
||||
advancedSet.insert(key.left(key.size() - 9 /* "-ADVANCED" */));
|
||||
} else if (key.endsWith("-STRINGS") && CMakeConfigItem::typeStringToType(type) == CMakeConfigItem::INTERNAL) {
|
||||
valuesMap[key.left(key.count() - 8) /* "-STRINGS" */] = value;
|
||||
valuesMap[key.left(key.size() - 8) /* "-STRINGS" */] = value;
|
||||
} else {
|
||||
CMakeConfigItem::Type t = CMakeConfigItem::typeStringToType(type);
|
||||
result << CMakeConfigItem(key, t, documentation, value);
|
||||
|
||||
@@ -157,7 +157,7 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
|
||||
// find the beginning of a filename
|
||||
QString buffer;
|
||||
int beginPos = column;
|
||||
int beginPos = column - 1;
|
||||
while (beginPos >= 0) {
|
||||
if (isValidFileNameChar(block, beginPos)) {
|
||||
buffer.prepend(block.at(beginPos));
|
||||
|
||||
@@ -75,22 +75,15 @@ public:
|
||||
m_comboBox->setEnabled(false);
|
||||
m_comboBox->setToolTip(ki->description());
|
||||
|
||||
const QList<CMakeTool *> tools = CMakeToolManager::cmakeTools();
|
||||
for (const CMakeTool *tool : tools)
|
||||
cmakeToolAdded(tool->id());
|
||||
|
||||
updateComboBox();
|
||||
refresh();
|
||||
|
||||
connect(m_comboBox, &QComboBox::currentIndexChanged,
|
||||
this, &CMakeKitAspectWidget::currentCMakeToolChanged);
|
||||
|
||||
CMakeToolManager *cmakeMgr = CMakeToolManager::instance();
|
||||
connect(cmakeMgr, &CMakeToolManager::cmakeAdded,
|
||||
this, &CMakeKitAspectWidget::cmakeToolAdded);
|
||||
connect(cmakeMgr, &CMakeToolManager::cmakeRemoved,
|
||||
this, &CMakeKitAspectWidget::cmakeToolRemoved);
|
||||
connect(cmakeMgr, &CMakeToolManager::cmakeUpdated,
|
||||
this, &CMakeKitAspectWidget::cmakeToolUpdated);
|
||||
connect(cmakeMgr, &CMakeToolManager::cmakeAdded, this, &CMakeKitAspectWidget::refresh);
|
||||
connect(cmakeMgr, &CMakeToolManager::cmakeRemoved, this, &CMakeKitAspectWidget::refresh);
|
||||
connect(cmakeMgr, &CMakeToolManager::cmakeUpdated, this, &CMakeKitAspectWidget::refresh);
|
||||
}
|
||||
|
||||
~CMakeKitAspectWidget() override
|
||||
@@ -112,6 +105,37 @@ private:
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
const GuardLocker locker(m_ignoreChanges);
|
||||
m_comboBox->clear();
|
||||
|
||||
IDeviceConstPtr device = BuildDeviceKitAspect::device(kit());
|
||||
const FilePath rootPath = device->rootPath();
|
||||
|
||||
const auto list = CMakeToolManager::cmakeTools();
|
||||
|
||||
m_comboBox->setEnabled(!list.isEmpty());
|
||||
|
||||
if (list.isEmpty()) {
|
||||
m_comboBox->addItem(Tr::tr("<No CMake Tool available>"), Id().toSetting());
|
||||
return;
|
||||
}
|
||||
|
||||
const QList<CMakeTool *> same = Utils::filtered(list, [rootPath](CMakeTool *item) {
|
||||
return item->cmakeExecutable().isSameDevice(rootPath);
|
||||
});
|
||||
const QList<CMakeTool *> other = Utils::filtered(list, [rootPath](CMakeTool *item) {
|
||||
return !item->cmakeExecutable().isSameDevice(rootPath);
|
||||
});
|
||||
|
||||
for (CMakeTool *item : same)
|
||||
m_comboBox->addItem(item->displayName(), item->id().toSetting());
|
||||
|
||||
if (!same.isEmpty() && !other.isEmpty())
|
||||
m_comboBox->insertSeparator(m_comboBox->count());
|
||||
|
||||
for (CMakeTool *item : other)
|
||||
m_comboBox->addItem(item->displayName(), item->id().toSetting());
|
||||
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(m_kit);
|
||||
m_comboBox->setCurrentIndex(tool ? indexOf(tool->id()) : -1);
|
||||
}
|
||||
@@ -125,58 +149,6 @@ private:
|
||||
return -1;
|
||||
}
|
||||
|
||||
void updateComboBox()
|
||||
{
|
||||
// remove unavailable cmake tool:
|
||||
int pos = indexOf(Id());
|
||||
if (pos >= 0)
|
||||
m_comboBox->removeItem(pos);
|
||||
|
||||
if (m_comboBox->count() == 0) {
|
||||
m_comboBox->addItem(Tr::tr("<No CMake Tool available>"), Id().toSetting());
|
||||
m_comboBox->setEnabled(false);
|
||||
} else {
|
||||
m_comboBox->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void cmakeToolAdded(Id id)
|
||||
{
|
||||
const CMakeTool *tool = CMakeToolManager::findById(id);
|
||||
QTC_ASSERT(tool, return);
|
||||
|
||||
m_comboBox->addItem(tool->displayName(), tool->id().toSetting());
|
||||
updateComboBox();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void cmakeToolUpdated(Id id)
|
||||
{
|
||||
const int pos = indexOf(id);
|
||||
QTC_ASSERT(pos >= 0, return);
|
||||
|
||||
const CMakeTool *tool = CMakeToolManager::findById(id);
|
||||
QTC_ASSERT(tool, return);
|
||||
|
||||
m_comboBox->setItemText(pos, tool->displayName());
|
||||
}
|
||||
|
||||
void cmakeToolRemoved(Id id)
|
||||
{
|
||||
const int pos = indexOf(id);
|
||||
QTC_ASSERT(pos >= 0, return);
|
||||
|
||||
{
|
||||
// do not handle the current index changed signal
|
||||
const GuardLocker locker(m_ignoreChanges);
|
||||
m_comboBox->removeItem(pos);
|
||||
}
|
||||
|
||||
// update the checkbox and set the current index
|
||||
updateComboBox();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void currentCMakeToolChanged(int index)
|
||||
{
|
||||
if (m_ignoreChanges.isLocked())
|
||||
|
||||
@@ -431,7 +431,7 @@ static QVector<ToolChainDescription> extractToolChainsFromCache(const CMakeConfi
|
||||
for (const CMakeConfigItem &i : config) {
|
||||
if (!i.key.startsWith("CMAKE_") || !i.key.endsWith("_COMPILER"))
|
||||
continue;
|
||||
const QByteArray language = i.key.mid(6, i.key.count() - 6 - 9); // skip "CMAKE_" and "_COMPILER"
|
||||
const QByteArray language = i.key.mid(6, i.key.size() - 6 - 9); // skip "CMAKE_" and "_COMPILER"
|
||||
Id languageId;
|
||||
if (language == "CXX") {
|
||||
haveCCxxCompiler = true;
|
||||
|
||||
@@ -6,18 +6,17 @@
|
||||
#include <coreplugin/coreplugintr.h>
|
||||
#include <coreplugin/dialogs/shortcutsettings.h>
|
||||
|
||||
#include <utils/headerviewstretcher.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/headerviewstretcher.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPointer>
|
||||
#include <QPushButton>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
Q_DECLARE_METATYPE(Core::Internal::ShortcutItem*)
|
||||
|
||||
@@ -32,13 +31,10 @@ public:
|
||||
CommandMappingsPrivate(CommandMappings *parent)
|
||||
: q(parent)
|
||||
{
|
||||
groupBox = new QGroupBox(parent);
|
||||
groupBox->setTitle(::Core::Tr::tr("Command Mappings"));
|
||||
|
||||
filterEdit = new FancyLineEdit(groupBox);
|
||||
filterEdit = new FancyLineEdit;
|
||||
filterEdit->setFiltering(true);
|
||||
|
||||
commandList = new QTreeWidget(groupBox);
|
||||
commandList = new QTreeWidget;
|
||||
commandList->setRootIsDecorated(false);
|
||||
commandList->setUniformRowHeights(true);
|
||||
commandList->setSortingEnabled(true);
|
||||
@@ -49,33 +45,28 @@ public:
|
||||
item->setText(1, ::Core::Tr::tr("Label"));
|
||||
item->setText(0, ::Core::Tr::tr("Command"));
|
||||
|
||||
defaultButton = new QPushButton(::Core::Tr::tr("Reset All"), groupBox);
|
||||
defaultButton = new QPushButton(::Core::Tr::tr("Reset All"));
|
||||
defaultButton->setToolTip(::Core::Tr::tr("Reset all to default."));
|
||||
|
||||
resetButton = new QPushButton(::Core::Tr::tr("Reset"), groupBox);
|
||||
resetButton = new QPushButton(::Core::Tr::tr("Reset"));
|
||||
resetButton->setToolTip(::Core::Tr::tr("Reset to default."));
|
||||
resetButton->setVisible(false);
|
||||
|
||||
importButton = new QPushButton(::Core::Tr::tr("Import..."), groupBox);
|
||||
exportButton = new QPushButton(::Core::Tr::tr("Export..."), groupBox);
|
||||
importButton = new QPushButton(::Core::Tr::tr("Import..."));
|
||||
exportButton = new QPushButton(::Core::Tr::tr("Export..."));
|
||||
|
||||
auto hboxLayout1 = new QHBoxLayout();
|
||||
hboxLayout1->addWidget(defaultButton);
|
||||
hboxLayout1->addWidget(resetButton);
|
||||
hboxLayout1->addStretch();
|
||||
hboxLayout1->addWidget(importButton);
|
||||
hboxLayout1->addWidget(exportButton);
|
||||
|
||||
auto hboxLayout = new QHBoxLayout();
|
||||
hboxLayout->addWidget(filterEdit);
|
||||
|
||||
auto vboxLayout1 = new QVBoxLayout(groupBox);
|
||||
vboxLayout1->addLayout(hboxLayout);
|
||||
vboxLayout1->addWidget(commandList);
|
||||
vboxLayout1->addLayout(hboxLayout1);
|
||||
|
||||
auto vboxLayout = new QVBoxLayout(parent);
|
||||
vboxLayout->addWidget(groupBox);
|
||||
using namespace Layouting;
|
||||
Column {
|
||||
Group {
|
||||
title(::Core::Tr::tr("Command Mappings")),
|
||||
bindTo(&groupBox),
|
||||
Column {
|
||||
filterEdit,
|
||||
commandList,
|
||||
Row { defaultButton, resetButton, st, importButton, exportButton },
|
||||
},
|
||||
},
|
||||
}.attachTo(parent);
|
||||
|
||||
q->connect(exportButton, &QPushButton::clicked,
|
||||
q, &CommandMappings::exportAction);
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/checkablemessagebox.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/infobar.h>
|
||||
@@ -70,6 +69,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
#include <QScopeGuard>
|
||||
#include <QSet>
|
||||
#include <QSettings>
|
||||
#include <QSplitter>
|
||||
@@ -3325,9 +3325,7 @@ IEditor *EditorManager::openEditorWithContents(Id editorId,
|
||||
EditorManager::gotoOtherSplit();
|
||||
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
Utils::ExecuteOnDestruction appRestoreCursor(&QApplication::restoreOverrideCursor);
|
||||
Q_UNUSED(appRestoreCursor)
|
||||
|
||||
const auto cleanup = qScopeGuard(&QApplication::restoreOverrideCursor);
|
||||
|
||||
const QString title = makeTitleUnique(titlePattern);
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
|
||||
Form form;
|
||||
form.addRow({Tr::tr("Color:"), m_colorButton, resetColorButton, st});
|
||||
form.addRow({Tr::tr("Theme:"), m_themeChooser});
|
||||
form.addRow({Tr::tr("Toolbar style:"), m_toolbarStyleBox, st});
|
||||
form.addRow({Tr::tr("Language:"), m_languageBox, st});
|
||||
|
||||
if (!Utils::HostOsInfo::isMacHost()) {
|
||||
@@ -125,7 +126,6 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
|
||||
form.addRow({empty, m_showShortcutsInContextMenus});
|
||||
form.addRow({Row{m_resetWarningsButton, st}});
|
||||
form.addRow({Tr::tr("Text codec for tools:"), m_codecBox, st});
|
||||
form.addRow({Tr::tr("Toolbar Style:"), m_toolbarStyleBox, st});
|
||||
Column{Group{title(Tr::tr("User Interface")), form}}.attachTo(this);
|
||||
|
||||
fillLanguageBox();
|
||||
@@ -152,7 +152,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
|
||||
|
||||
static bool hasQmFilesForLocale(const QString &locale, const QString &creatorTrPath)
|
||||
{
|
||||
static const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
static const QString qtTrPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||
|
||||
const QString trFile = QLatin1String("/qt_") + locale + QLatin1String(".qm");
|
||||
return QFile::exists(qtTrPath + trFile) || QFile::exists(creatorTrPath + trFile);
|
||||
|
||||
@@ -450,7 +450,7 @@ void LocatorMatcher::start()
|
||||
collectorStorage->m_collector = nullptr;
|
||||
};
|
||||
|
||||
QList<TaskItem> parallelTasks {parallelLimit(d->m_parallelLimit)};
|
||||
QList<GroupItem> parallelTasks {parallelLimit(d->m_parallelLimit)};
|
||||
|
||||
const auto onSetup = [this, collectorStorage](const TreeStorage<LocatorStorage> &storage,
|
||||
int index) {
|
||||
@@ -597,7 +597,7 @@ QString ILocatorFilter::shortcutString() const
|
||||
\internal
|
||||
Sets the refresh recipe for refreshing cached data.
|
||||
*/
|
||||
void ILocatorFilter::setRefreshRecipe(const std::optional<TaskItem> &recipe)
|
||||
void ILocatorFilter::setRefreshRecipe(const std::optional<GroupItem> &recipe)
|
||||
{
|
||||
m_refreshRecipe = recipe;
|
||||
}
|
||||
@@ -606,7 +606,7 @@ void ILocatorFilter::setRefreshRecipe(const std::optional<TaskItem> &recipe)
|
||||
Returns the refresh recipe for refreshing cached data. By default, the locator filter has
|
||||
no recipe set, so that it won't be refreshed.
|
||||
*/
|
||||
std::optional<TaskItem> ILocatorFilter::refreshRecipe() const
|
||||
std::optional<GroupItem> ILocatorFilter::refreshRecipe() const
|
||||
{
|
||||
return m_refreshRecipe;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class CORE_EXPORT LocatorMatcherTask final
|
||||
public:
|
||||
// The main task. Initial data (searchTerm) should be taken from storage.input().
|
||||
// Results reporting is done via the storage.reportOutput().
|
||||
Tasking::TaskItem task = Tasking::Group{};
|
||||
Tasking::GroupItem task = Tasking::Group{};
|
||||
|
||||
// When constructing the task, don't place the storage inside the task above.
|
||||
Tasking::TreeStorage<LocatorStorage> storage;
|
||||
@@ -270,8 +270,8 @@ protected:
|
||||
virtual void saveState(QJsonObject &object) const;
|
||||
virtual void restoreState(const QJsonObject &object);
|
||||
|
||||
void setRefreshRecipe(const std::optional<Tasking::TaskItem> &recipe);
|
||||
std::optional<Tasking::TaskItem> refreshRecipe() const;
|
||||
void setRefreshRecipe(const std::optional<Tasking::GroupItem> &recipe);
|
||||
std::optional<Tasking::GroupItem> refreshRecipe() const;
|
||||
|
||||
static bool isOldSetting(const QByteArray &state);
|
||||
|
||||
@@ -289,7 +289,7 @@ private:
|
||||
QString m_description;
|
||||
QString m_defaultShortcut;
|
||||
std::optional<QString> m_defaultSearchText;
|
||||
std::optional<Tasking::TaskItem> m_refreshRecipe;
|
||||
std::optional<Tasking::GroupItem> m_refreshRecipe;
|
||||
QKeySequence m_defaultKeySequence;
|
||||
bool m_defaultIncludedByDefault = false;
|
||||
bool m_includedByDefault = m_defaultIncludedByDefault;
|
||||
|
||||
@@ -381,7 +381,7 @@ void Locator::refresh(const QList<ILocatorFilter *> &filters)
|
||||
m_refreshingFilters = Utils::filteredUnique(m_refreshingFilters + filters);
|
||||
|
||||
using namespace Tasking;
|
||||
QList<TaskItem> tasks{parallel};
|
||||
QList<GroupItem> tasks{parallel};
|
||||
for (ILocatorFilter *filter : std::as_const(m_refreshingFilters)) {
|
||||
const auto task = filter->refreshRecipe();
|
||||
if (!task.has_value())
|
||||
|
||||
@@ -105,7 +105,7 @@ static QList<FilterRuleSpec> fetchOriginalRules()
|
||||
};
|
||||
|
||||
Utils::FilePath iniFile = Utils::FilePath::fromString(
|
||||
QLibraryInfo::location(QLibraryInfo::DataPath)).pathAppended("qtlogging.ini");
|
||||
QLibraryInfo::path(QLibraryInfo::DataPath)).pathAppended("qtlogging.ini");
|
||||
if (iniFile.exists())
|
||||
appendRulesFromFile(iniFile.toString());
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/basetreeview.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/listmodel.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -33,6 +32,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QRegularExpression>
|
||||
#include <QScopeGuard>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QToolButton>
|
||||
@@ -591,7 +591,7 @@ void LoggingViewManagerWidget::saveLoggingsToFile() const
|
||||
{
|
||||
// should we just let it continue without temporarily disabling?
|
||||
const bool enabled = m_manager->isEnabled();
|
||||
Utils::ExecuteOnDestruction exec([this, enabled] { m_manager->setEnabled(enabled); });
|
||||
const auto cleanup = qScopeGuard([this, enabled] { m_manager->setEnabled(enabled); });
|
||||
if (enabled)
|
||||
m_manager->setEnabled(false);
|
||||
const Utils::FilePath fp = Utils::FileUtils::getSaveFilePath(ICore::dialogParent(),
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "wrappablelineedit.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/infolabel.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/stringutils.h>
|
||||
@@ -21,6 +20,7 @@
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QPushButton>
|
||||
#include <QScopeGuard>
|
||||
#include <QTabWidget>
|
||||
#include <QTreeView>
|
||||
|
||||
@@ -323,7 +323,7 @@ void ClangDiagnosticConfigsWidget::sync()
|
||||
return;
|
||||
|
||||
disconnectClangOnlyOptionsChanged();
|
||||
ExecuteOnDestruction e([this] { connectClangOnlyOptionsChanged(); });
|
||||
const QScopeGuard cleanup([this] { connectClangOnlyOptionsChanged(); });
|
||||
|
||||
// Update main button row
|
||||
const ClangDiagnosticConfig &config = currentConfig();
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#include <texteditor/textdocument.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
|
||||
#include <QScopeGuard>
|
||||
#include <QtTest>
|
||||
|
||||
#endif // WITH_TESTS
|
||||
@@ -267,9 +267,7 @@ void AutoCompleterTest::testAutoComplete()
|
||||
|
||||
QVERIFY(text.contains(QLatin1Char('|')));
|
||||
|
||||
Utils::ExecuteOnDestruction guard([](){
|
||||
Core::EditorManager::closeAllEditors(false);
|
||||
});
|
||||
const QScopeGuard cleanup([] { Core::EditorManager::closeAllEditors(false); });
|
||||
QTextCursor tc = openEditor(text);
|
||||
|
||||
QVERIFY(!tc.isNull());
|
||||
@@ -328,9 +326,7 @@ void AutoCompleterTest::testSurroundWithSelection()
|
||||
|
||||
QVERIFY(text.count(QLatin1Char('|')) == 2);
|
||||
|
||||
Utils::ExecuteOnDestruction guard([](){
|
||||
Core::EditorManager::closeAllEditors(false);
|
||||
});
|
||||
const QScopeGuard cleanup([] { Core::EditorManager::closeAllEditors(false); });
|
||||
QTextCursor tc = openEditor(text);
|
||||
|
||||
QVERIFY(!tc.isNull());
|
||||
@@ -363,9 +359,7 @@ void AutoCompleterTest::testAutoBackspace()
|
||||
|
||||
QVERIFY(text.contains(QLatin1Char('|')));
|
||||
|
||||
Utils::ExecuteOnDestruction guard([](){
|
||||
Core::EditorManager::closeAllEditors(false);
|
||||
});
|
||||
const QScopeGuard cleanup([] { Core::EditorManager::closeAllEditors(false); });
|
||||
QTextCursor tc = openEditor(text);
|
||||
|
||||
QVERIFY(!tc.isNull());
|
||||
@@ -405,9 +399,7 @@ void AutoCompleterTest::testInsertParagraph()
|
||||
|
||||
QVERIFY(text.contains(QLatin1Char('|')));
|
||||
|
||||
Utils::ExecuteOnDestruction guard([](){
|
||||
Core::EditorManager::closeAllEditors(false);
|
||||
});
|
||||
const QScopeGuard cleanup([] { Core::EditorManager::closeAllEditors(false); });
|
||||
QTextCursor tc = openEditor(text);
|
||||
|
||||
QVERIFY(!tc.isNull());
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
#include <app/app_version.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <texteditor/basehoverhandler.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/textutils.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#include <QScopeGuard>
|
||||
#include <QTextDocument>
|
||||
|
||||
using namespace Core;
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
Utils::ExecuteOnDestruction reportPriority([this, report](){ report(priority()); });
|
||||
const QScopeGuard cleanup([this, report] { report(priority()); });
|
||||
|
||||
QTextCursor tc(editorWidget->document());
|
||||
tc.setPosition(pos);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <texteditor/textdocumentlayout.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/infobar.h>
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/minimizableinfobars.h>
|
||||
@@ -31,6 +30,7 @@
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QScopeGuard>
|
||||
#include <QTextDocument>
|
||||
|
||||
const char NO_PROJECT_CONFIGURATION[] = "NoProject";
|
||||
@@ -437,9 +437,9 @@ TextEditor::TabSettings CppEditorDocument::tabSettings() const
|
||||
|
||||
bool CppEditorDocument::save(QString *errorString, const FilePath &filePath, bool autoSave)
|
||||
{
|
||||
ExecuteOnDestruction resetSettingsOnScopeExit;
|
||||
if (!indenter()->formatOnSave() || autoSave)
|
||||
return TextEditor::TextDocument::save(errorString, filePath, autoSave);
|
||||
|
||||
if (indenter()->formatOnSave() && !autoSave) {
|
||||
auto *layout = qobject_cast<TextEditor::TextDocumentLayout *>(document()->documentLayout());
|
||||
const int documentRevision = layout->lastSaveRevision;
|
||||
|
||||
@@ -472,11 +472,9 @@ bool CppEditorDocument::save(QString *errorString, const FilePath &filePath, boo
|
||||
}
|
||||
|
||||
TextEditor::StorageSettings settings = storageSettings();
|
||||
resetSettingsOnScopeExit.reset(
|
||||
[this, defaultSettings = settings]() { setStorageSettings(defaultSettings); });
|
||||
const QScopeGuard cleanup([this, settings] { setStorageSettings(settings); });
|
||||
settings.m_cleanWhitespace = false;
|
||||
setStorageSettings(settings);
|
||||
}
|
||||
|
||||
return TextEditor::TextDocument::save(errorString, filePath, autoSave);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QScopeGuard>
|
||||
#include <QtTest>
|
||||
|
||||
#define VERIFY_DOCUMENT_REVISION(document, expectedRevision) \
|
||||
@@ -1085,9 +1085,7 @@ void ModelManagerTest::testRenameIncludesInEditor()
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(mainFile);
|
||||
QVERIFY(editor);
|
||||
EditorCloser editorCloser(editor);
|
||||
Utils::ExecuteOnDestruction saveAllFiles([](){
|
||||
Core::DocumentManager::saveAllModifiedDocumentsSilently();
|
||||
});
|
||||
const QScopeGuard cleanup([] { Core::DocumentManager::saveAllModifiedDocumentsSilently(); });
|
||||
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
|
||||
QVERIFY(modelManager->isCppEditor(editor));
|
||||
QVERIFY(modelManager->workingCopy().get(mainFile));
|
||||
|
||||
@@ -64,7 +64,7 @@ void CppProjectUpdater::update(const ProjectUpdateInfo &projectUpdateInfo,
|
||||
if (async.isResultAvailable())
|
||||
storage->projectInfo = async.result();
|
||||
};
|
||||
QList<TaskItem> tasks{parallel};
|
||||
QList<GroupItem> tasks{parallel};
|
||||
tasks.append(AsyncTask<ProjectInfo::ConstPtr>(setupInfoGenerator, onInfoGeneratorDone));
|
||||
for (QPointer<ExtraCompiler> compiler : compilers) {
|
||||
if (compiler && compiler->isDirty())
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <texteditor/storagesettings.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -376,11 +375,8 @@ ProjectOpenerAndCloser::~ProjectOpenerAndCloser()
|
||||
return;
|
||||
|
||||
bool hasGcFinished = false;
|
||||
QMetaObject::Connection connection;
|
||||
Utils::ExecuteOnDestruction disconnect([&]() { QObject::disconnect(connection); });
|
||||
connection = QObject::connect(CppModelManager::instance(), &CppModelManager::gcFinished, [&]() {
|
||||
hasGcFinished = true;
|
||||
});
|
||||
auto connection = QObject::connect(CppModelManager::instance(), &CppModelManager::gcFinished,
|
||||
[&hasGcFinished] { hasGcFinished = true; });
|
||||
|
||||
for (Project *project : std::as_const(m_openProjects))
|
||||
ProjectExplorerPlugin::unloadProject(project);
|
||||
@@ -389,6 +385,8 @@ ProjectOpenerAndCloser::~ProjectOpenerAndCloser()
|
||||
t.start();
|
||||
while (!hasGcFinished && t.elapsed() <= 30000)
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
QObject::disconnect(connection);
|
||||
}
|
||||
|
||||
ProjectInfo::ConstPtr ProjectOpenerAndCloser::open(const FilePath &projectFile,
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/projecttree.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/tooltip/tooltip.h>
|
||||
|
||||
#include <QPoint>
|
||||
#include <QScopeGuard>
|
||||
#include <QTextBlock>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
@@ -148,7 +148,7 @@ void ResourcePreviewHoverHandler::identifyMatch(TextEditorWidget *editorWidget,
|
||||
int pos,
|
||||
ReportPriority report)
|
||||
{
|
||||
Utils::ExecuteOnDestruction reportPriority([this, report](){ report(priority()); });
|
||||
const QScopeGuard cleanup([this, report] { report(priority()); });
|
||||
|
||||
if (editorWidget->extraSelectionTooltip(pos).isEmpty()) {
|
||||
const QTextBlock tb = editorWidget->document()->findBlock(pos);
|
||||
|
||||
@@ -84,9 +84,9 @@ public:
|
||||
{
|
||||
TextMark::updateLineNumber(lineNumber);
|
||||
QTC_ASSERT(m_bp, return);
|
||||
m_bp->setLineNumber(lineNumber);
|
||||
m_bp->setTextPosition({lineNumber, -1});
|
||||
if (GlobalBreakpoint gbp = m_bp->globalBreakpoint())
|
||||
gbp->m_params.lineNumber = lineNumber;
|
||||
gbp->m_params.textPosition.line = lineNumber;
|
||||
}
|
||||
|
||||
void updateFilePath(const FilePath &fileName) final
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
if (!gbp)
|
||||
return;
|
||||
BreakpointParameters params = gbp->m_params;
|
||||
params.lineNumber = line;
|
||||
params.textPosition.line = line;
|
||||
gbp->deleteBreakpoint();
|
||||
BreakpointManager::createBreakpoint(params);
|
||||
}
|
||||
@@ -643,7 +643,7 @@ void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data)
|
||||
data->enabled = m_checkBoxEnabled->isChecked();
|
||||
|
||||
if (partsMask & FileAndLinePart) {
|
||||
data->lineNumber = m_lineEditLineNumber->text().toInt();
|
||||
data->textPosition.line = m_lineEditLineNumber->text().toInt();
|
||||
data->pathUsage = static_cast<BreakpointPathUsage>(m_comboBoxPathUsage->currentIndex());
|
||||
data->fileName = m_pathChooserFileName->filePath();
|
||||
}
|
||||
@@ -683,7 +683,7 @@ void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data)
|
||||
|
||||
if (mask & FileAndLinePart) {
|
||||
m_pathChooserFileName->setFilePath(data.fileName);
|
||||
m_lineEditLineNumber->setText(QString::number(data.lineNumber));
|
||||
m_lineEditLineNumber->setText(QString::number(data.textPosition.line));
|
||||
}
|
||||
|
||||
if (mask & FunctionPart)
|
||||
@@ -889,7 +889,7 @@ BreakHandler::BreakHandler(DebuggerEngine *engine)
|
||||
|
||||
bool BreakpointParameters::isLocatedAt(const FilePath &file, int line, const FilePath &markerFile) const
|
||||
{
|
||||
return lineNumber == line && (fileName == file || fileName == markerFile);
|
||||
return textPosition.line == line && (fileName == file || fileName == markerFile);
|
||||
}
|
||||
|
||||
static bool isSimilarTo(const BreakpointParameters ¶ms, const BreakpointParameters &needle)
|
||||
@@ -911,7 +911,7 @@ static bool isSimilarTo(const BreakpointParameters ¶ms, const BreakpointPara
|
||||
// FIXME: breaks multiple breakpoints at the same location
|
||||
if (!params.fileName.isEmpty()
|
||||
&& params.fileName == needle.fileName
|
||||
&& params.lineNumber == needle.lineNumber)
|
||||
&& params.textPosition == needle.textPosition)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1064,7 +1064,7 @@ QVariant BreakpointItem::data(int column, int role) const
|
||||
return empty;
|
||||
}
|
||||
if (role == Qt::UserRole + 1)
|
||||
return m_parameters.lineNumber;
|
||||
return m_parameters.textPosition.line;
|
||||
break;
|
||||
case BreakpointAddressColumn:
|
||||
if (role == Qt::DisplayRole) {
|
||||
@@ -1121,7 +1121,7 @@ void BreakpointItem::addToCommand(DebuggerCommand *cmd) const
|
||||
cmd->arg("oneshot", requested.oneShot);
|
||||
cmd->arg("enabled", requested.enabled);
|
||||
cmd->arg("file", requested.fileName.path());
|
||||
cmd->arg("line", requested.lineNumber);
|
||||
cmd->arg("line", requested.textPosition.line);
|
||||
cmd->arg("address", requested.address);
|
||||
cmd->arg("expression", requested.expression);
|
||||
}
|
||||
@@ -1186,12 +1186,13 @@ void BreakHandler::requestSubBreakpointEnabling(const SubBreakpoint &sbp, bool e
|
||||
}
|
||||
}
|
||||
|
||||
void BreakpointItem::setMarkerFileAndLine(const FilePath &fileName, int lineNumber)
|
||||
void BreakpointItem::setMarkerFileAndPosition(const FilePath &fileName,
|
||||
const Text::Position &textPosition)
|
||||
{
|
||||
if (m_parameters.fileName == fileName && m_parameters.lineNumber == lineNumber)
|
||||
if (m_parameters.fileName == fileName && m_parameters.textPosition == textPosition)
|
||||
return;
|
||||
m_parameters.fileName = fileName;
|
||||
m_parameters.lineNumber = lineNumber;
|
||||
m_parameters.textPosition = textPosition;
|
||||
destroyMarker();
|
||||
updateMarker();
|
||||
update();
|
||||
@@ -1258,7 +1259,8 @@ void BreakHandler::removeDisassemblerMarker(const Breakpoint &bp)
|
||||
|
||||
static bool matches(const Location &loc, const BreakpointParameters &bp)
|
||||
{
|
||||
if (loc.fileName() == bp.fileName && loc.lineNumber() == bp.lineNumber && bp.lineNumber > 0)
|
||||
if (loc.fileName() == bp.fileName && loc.textPosition() == bp.textPosition
|
||||
&& bp.textPosition.line > 0)
|
||||
return true;
|
||||
if (loc.address() == bp.address && bp.address > 0)
|
||||
return true;
|
||||
@@ -1836,9 +1838,9 @@ FilePath BreakpointItem::markerFileName() const
|
||||
|
||||
int BreakpointItem::markerLineNumber() const
|
||||
{
|
||||
if (m_parameters.lineNumber > 0)
|
||||
return m_parameters.lineNumber;
|
||||
return requestedParameters().lineNumber;
|
||||
if (m_parameters.textPosition.line > 0)
|
||||
return m_parameters.textPosition.line;
|
||||
return requestedParameters().textPosition.line;
|
||||
}
|
||||
|
||||
const BreakpointParameters &BreakpointItem::requestedParameters() const
|
||||
@@ -1869,7 +1871,9 @@ bool BreakpointItem::needsChange() const
|
||||
return true;
|
||||
if (oparams.command != m_parameters.command)
|
||||
return true;
|
||||
if (oparams.type == BreakpointByFileAndLine && oparams.lineNumber != m_parameters.lineNumber)
|
||||
if (oparams.type == BreakpointByFileAndLine && oparams.textPosition != m_parameters.textPosition)
|
||||
return true;
|
||||
if (oparams.pathUsage != m_parameters.pathUsage)
|
||||
return true;
|
||||
// FIXME: Too strict, functions may have parameter lists, or not.
|
||||
// if (m_params.type == BreakpointByFunction && m_params.functionName != m_response.functionName)
|
||||
@@ -1950,8 +1954,8 @@ QString BreakpointItem::toolTip() const
|
||||
<< "</td><td>" << m_parameters.fileName.toUserOutput()
|
||||
<< "</td></tr>"
|
||||
<< "<tr><td>" << Tr::tr("Line Number:")
|
||||
<< "</td><td>" << requested.lineNumber
|
||||
<< "</td><td>" << m_parameters.lineNumber << "</td></tr>";
|
||||
<< "</td><td>" << requested.textPosition.line
|
||||
<< "</td><td>" << m_parameters.textPosition.line << "</td></tr>";
|
||||
}
|
||||
if (requested.type == BreakpointByFunction || m_parameters.type == BreakpointByFileAndLine) {
|
||||
str << "<tr><td>" << Tr::tr("Module:")
|
||||
@@ -2163,12 +2167,12 @@ QVariant GlobalBreakpointItem::data(int column, int role) const
|
||||
break;
|
||||
case BreakpointLineColumn:
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (m_params.lineNumber > 0)
|
||||
return m_params.lineNumber;
|
||||
if (m_params.textPosition.line > 0)
|
||||
return m_params.textPosition.line;
|
||||
return empty;
|
||||
}
|
||||
if (role == Qt::UserRole + 1)
|
||||
return m_params.lineNumber;
|
||||
return m_params.textPosition.line;
|
||||
break;
|
||||
case BreakpointAddressColumn:
|
||||
if (role == Qt::DisplayRole) {
|
||||
@@ -2270,9 +2274,9 @@ void GlobalBreakpointItem::removeBreakpointFromModel()
|
||||
|
||||
void GlobalBreakpointItem::updateLineNumber(int lineNumber)
|
||||
{
|
||||
if (m_params.lineNumber == lineNumber)
|
||||
if (m_params.textPosition.line == lineNumber)
|
||||
return;
|
||||
m_params.lineNumber = lineNumber;
|
||||
m_params.textPosition.line = lineNumber;
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -2294,7 +2298,7 @@ FilePath GlobalBreakpointItem::markerFileName() const
|
||||
|
||||
int GlobalBreakpointItem::markerLineNumber() const
|
||||
{
|
||||
return m_params.lineNumber;
|
||||
return m_params.textPosition.line;
|
||||
}
|
||||
|
||||
void GlobalBreakpointItem::updateMarker()
|
||||
@@ -2306,7 +2310,7 @@ void GlobalBreakpointItem::updateMarker()
|
||||
return;
|
||||
}
|
||||
|
||||
const int line = m_params.lineNumber;
|
||||
const int line = m_params.textPosition.line;
|
||||
if (m_marker) {
|
||||
if (m_params.fileName != m_marker->filePath())
|
||||
m_marker->updateFilePath(m_params.fileName);
|
||||
@@ -2373,7 +2377,7 @@ QString GlobalBreakpointItem::toolTip() const
|
||||
<< "</td><td>" << m_params.fileName.toUserOutput()
|
||||
<< "</td></tr>"
|
||||
<< "<tr><td>" << Tr::tr("Line Number:")
|
||||
<< "</td><td>" << m_params.lineNumber;
|
||||
<< "</td><td>" << m_params.textPosition.line;
|
||||
}
|
||||
if (m_params.type == BreakpointByFunction || m_params.type == BreakpointByFileAndLine) {
|
||||
str << "<tr><td>" << Tr::tr("Module:")
|
||||
@@ -2487,7 +2491,7 @@ void BreakpointManager::setOrRemoveBreakpoint(const ContextData &location, const
|
||||
data.tracepoint = !tracePointMessage.isEmpty();
|
||||
data.message = tracePointMessage;
|
||||
data.fileName = location.fileName;
|
||||
data.lineNumber = location.lineNumber;
|
||||
data.textPosition = location.textPosition;
|
||||
} else if (location.type == LocationByAddress) {
|
||||
data.type = BreakpointByAddress;
|
||||
data.tracepoint = !tracePointMessage.isEmpty();
|
||||
@@ -2513,7 +2517,7 @@ GlobalBreakpoint BreakpointManager::findBreakpointFromContext(const ContextData
|
||||
GlobalBreakpoint bestMatch;
|
||||
theBreakpointManager->forItemsAtLevel<1>([&](const GlobalBreakpoint &gbp) {
|
||||
if (location.type == LocationByFile) {
|
||||
if (gbp->m_params.isLocatedAt(location.fileName, location.lineNumber, FilePath())) {
|
||||
if (gbp->m_params.isLocatedAt(location.fileName, location.textPosition.line, FilePath())) {
|
||||
matchLevel = 2;
|
||||
bestMatch = gbp;
|
||||
} else if (matchLevel < 2) {
|
||||
@@ -2522,7 +2526,7 @@ GlobalBreakpoint BreakpointManager::findBreakpointFromContext(const ContextData
|
||||
for (Breakpoint bp : handler->breakpoints()) {
|
||||
if (bp->globalBreakpoint() == gbp) {
|
||||
if (bp->fileName() == location.fileName
|
||||
&& bp->lineNumber() == location.lineNumber) {
|
||||
&& bp->textPosition() == location.textPosition) {
|
||||
matchLevel = 1;
|
||||
bestMatch = gbp;
|
||||
}
|
||||
@@ -2768,8 +2772,8 @@ void BreakpointManager::saveSessionData()
|
||||
map.insert("type", params.type);
|
||||
if (!params.fileName.isEmpty())
|
||||
map.insert("filename", params.fileName.toSettings());
|
||||
if (params.lineNumber)
|
||||
map.insert("linenumber", params.lineNumber);
|
||||
if (params.textPosition.line)
|
||||
map.insert("linenumber", params.textPosition.line);
|
||||
if (!params.functionName.isEmpty())
|
||||
map.insert("funcname", params.functionName);
|
||||
if (params.address)
|
||||
@@ -2815,7 +2819,7 @@ void BreakpointManager::loadSessionData()
|
||||
params.fileName = FilePath::fromSettings(v);
|
||||
v = map.value("linenumber");
|
||||
if (v.isValid())
|
||||
params.lineNumber = v.toString().toInt();
|
||||
params.textPosition.line = v.toString().toInt();
|
||||
v = map.value("condition");
|
||||
if (v.isValid())
|
||||
params.condition = v.toString();
|
||||
|
||||
@@ -98,7 +98,8 @@ public:
|
||||
|
||||
QIcon icon(bool withLocationMarker = false) const;
|
||||
|
||||
void setMarkerFileAndLine(const Utils::FilePath &fileName, int lineNumber);
|
||||
void setMarkerFileAndPosition(const Utils::FilePath &fileName,
|
||||
const Utils::Text::Position &textPosition);
|
||||
bool needsChange() const;
|
||||
|
||||
SubBreakpoint findOrCreateSubBreakpoint(const QString &responseId);
|
||||
@@ -128,14 +129,14 @@ public:
|
||||
QString message() const { return m_parameters.message; }
|
||||
QString command() const { return m_parameters.command; }
|
||||
quint64 address() const { return m_parameters.address; }
|
||||
int lineNumber() const { return m_parameters.lineNumber; }
|
||||
Utils::Text::Position textPosition() const { return m_parameters.textPosition; }
|
||||
bool isEnabled() const { return m_parameters.enabled; }
|
||||
bool isWatchpoint() const { return m_parameters.isWatchpoint(); }
|
||||
bool isTracepoint() const { return m_parameters.isTracepoint(); }
|
||||
bool isOneShot() const { return m_parameters.oneShot; }
|
||||
bool isPending() const { return m_parameters.pending; }
|
||||
|
||||
void setLineNumber(int lineNumber) { m_parameters.lineNumber = lineNumber; }
|
||||
void setTextPosition(const Utils::Text::Position pos) { m_parameters.textPosition = pos; }
|
||||
void setFileName(const Utils::FilePath &fileName) { m_parameters.fileName = fileName; }
|
||||
void setFunctionName(const QString &functionName) { m_parameters.functionName = functionName; }
|
||||
void setPending(bool pending);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Internal {
|
||||
|
||||
BreakpointParameters::BreakpointParameters(BreakpointType t)
|
||||
: type(t), enabled(true), pathUsage(BreakpointPathUsageEngineDefault),
|
||||
ignoreCount(0), lineNumber(0), address(0), size(0),
|
||||
ignoreCount(0), address(0), size(0),
|
||||
bitpos(0), bitsize(0), threadSpec(-1),
|
||||
tracepoint(false), oneShot(false)
|
||||
{}
|
||||
@@ -48,7 +48,7 @@ BreakpointParts BreakpointParameters::differencesTo
|
||||
parts |= ConditionPart;
|
||||
if (ignoreCount != rhs.ignoreCount)
|
||||
parts |= IgnoreCountPart;
|
||||
if (lineNumber != rhs.lineNumber)
|
||||
if (textPosition != rhs.textPosition)
|
||||
parts |= FileAndLinePart;
|
||||
if (address != rhs.address)
|
||||
parts |= AddressPart;
|
||||
@@ -73,7 +73,7 @@ bool BreakpointParameters::isValid() const
|
||||
{
|
||||
switch (type) {
|
||||
case BreakpointByFileAndLine:
|
||||
return !fileName.isEmpty() && lineNumber > 0;
|
||||
return !fileName.isEmpty() && textPosition.line > 0;
|
||||
case BreakpointByFunction:
|
||||
return !functionName.isEmpty();
|
||||
case WatchpointAtAddress:
|
||||
@@ -116,7 +116,7 @@ void BreakpointParameters::updateLocation(const QString &location)
|
||||
{
|
||||
if (!location.isEmpty()) {
|
||||
int pos = location.indexOf(':');
|
||||
lineNumber = location.mid(pos + 1).toInt();
|
||||
textPosition.line = location.mid(pos + 1).toInt(); // FIXME: Handle column
|
||||
QString file = location.left(pos);
|
||||
if (file.startsWith('"') && file.endsWith('"'))
|
||||
file = file.mid(1, file.size() - 2);
|
||||
@@ -164,8 +164,8 @@ QString BreakpointParameters::toString() const
|
||||
ts << "Type: " << type;
|
||||
switch (type) {
|
||||
case BreakpointByFileAndLine:
|
||||
ts << " FileName: " << fileName << ':' << lineNumber
|
||||
<< " PathUsage: " << pathUsage;
|
||||
ts << " FileName: " << fileName << ':' << textPosition.line;
|
||||
ts << " PathUsage: " << pathUsage;
|
||||
break;
|
||||
case BreakpointByFunction:
|
||||
case BreakpointOnQmlSignalEmit:
|
||||
@@ -295,7 +295,7 @@ void BreakpointParameters::updateFromGdbOutput(const GdbMi &bkpt, const Utils::F
|
||||
} else if (child.hasName("fullname")) {
|
||||
fullName = child.data();
|
||||
} else if (child.hasName("line")) {
|
||||
lineNumber = child.toInt();
|
||||
textPosition.line = child.toInt();
|
||||
} else if (child.hasName("cond")) {
|
||||
// gdb 6.3 likes to "rewrite" conditions. Just accept that fact.
|
||||
condition = child.data();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <QString>
|
||||
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/textutils.h>
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
@@ -139,7 +140,7 @@ public:
|
||||
Utils::FilePath fileName;//!< Short name of source file.
|
||||
QString condition; //!< Condition associated with breakpoint.
|
||||
int ignoreCount; //!< Ignore count associated with breakpoint.
|
||||
int lineNumber; //!< Line in source file.
|
||||
Utils::Text::Position textPosition; //!< Line and column in source file.
|
||||
quint64 address; //!< Address for address based data breakpoints.
|
||||
QString expression; //!< Expression for expression based data breakpoints.
|
||||
uint size; //!< Size of watched area for data breakpoints.
|
||||
|
||||
@@ -818,7 +818,7 @@ void CdbEngine::executeRunToLine(const ContextData &data)
|
||||
} else {
|
||||
bp.type =BreakpointByFileAndLine;
|
||||
bp.fileName = data.fileName;
|
||||
bp.lineNumber = data.lineNumber;
|
||||
bp.textPosition = data.textPosition;
|
||||
}
|
||||
|
||||
runCommand({cdbAddBreakpointCommand(bp, m_sourcePathMappings), BuiltinCommand,
|
||||
@@ -854,7 +854,7 @@ void CdbEngine::executeJumpToLine(const ContextData &data)
|
||||
// Jump to source line: Resolve source line address and go to that location
|
||||
QString cmd;
|
||||
StringInputStream str(cmd);
|
||||
str << "? `" << data.fileName.toUserOutput() << ':' << data.lineNumber << '`';
|
||||
str << "? `" << data.fileName.toUserOutput() << ':' << data.textPosition.line << '`';
|
||||
runCommand({cmd, BuiltinCommand, [this, data](const DebuggerResponse &r) {
|
||||
handleJumpToLineAddressResolution(r, data); }});
|
||||
}
|
||||
@@ -891,7 +891,7 @@ void CdbEngine::handleJumpToLineAddressResolution(const DebuggerResponse &respon
|
||||
const quint64 address = answer.toULongLong(&ok, 16);
|
||||
if (ok && address) {
|
||||
jumpToAddress(address);
|
||||
gotoLocation(Location(context.fileName, context.lineNumber));
|
||||
gotoLocation(Location(context.fileName, context.textPosition));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2505,8 +2505,9 @@ void CdbEngine::insertBreakpoint(const Breakpoint &bp)
|
||||
if (!m_autoBreakPointCorrection
|
||||
&& parameters.type == BreakpointByFileAndLine
|
||||
&& debuggerSettings()->cdbBreakPointCorrection.value()) {
|
||||
response.lineNumber = int(lineCorrection->fixLineNumber(parameters.fileName,
|
||||
unsigned(parameters.lineNumber)));
|
||||
response.textPosition.line =
|
||||
int(lineCorrection->fixLineNumber(parameters.fileName,
|
||||
unsigned(parameters.textPosition.line)));
|
||||
QString cmd = cdbAddBreakpointCommand(response, m_sourcePathMappings, responseId);
|
||||
runCommand({cmd, BuiltinCommand, handleBreakInsertCB});
|
||||
} else {
|
||||
@@ -2979,7 +2980,7 @@ BreakpointParameters CdbEngine::parseBreakPoint(const GdbMi &gdbmi)
|
||||
result.fileName = Utils::FilePath::fromUserInput(mappedFile.fileName);
|
||||
const GdbMi lineNumber = gdbmi["srcline"];
|
||||
if (lineNumber.isValid())
|
||||
result.lineNumber = lineNumber.data().toULongLong(nullptr, 0);
|
||||
result.textPosition.line = lineNumber.data().toULongLong(nullptr, 0);
|
||||
}
|
||||
const GdbMi addressG = gdbmi["address"];
|
||||
if (addressG.isValid())
|
||||
@@ -3036,7 +3037,7 @@ void CdbEngine::handleBreakPoints(const DebuggerResponse &response)
|
||||
currentResponse.pending = reportedResponse.pending;
|
||||
currentResponse.enabled = reportedResponse.enabled;
|
||||
currentResponse.fileName = reportedResponse.fileName;
|
||||
currentResponse.lineNumber = reportedResponse.lineNumber;
|
||||
currentResponse.textPosition = reportedResponse.textPosition;
|
||||
formatCdbBreakPointResponse(bp->modelId(), responseId, currentResponse, str);
|
||||
if (debugBreakpoints)
|
||||
qDebug(" Setting for %s: %s\n", qPrintable(responseId),
|
||||
@@ -3053,7 +3054,7 @@ void CdbEngine::handleBreakPoints(const DebuggerResponse &response)
|
||||
currentResponse.pending = reportedResponse.pending;
|
||||
currentResponse.enabled = reportedResponse.enabled;
|
||||
currentResponse.fileName = reportedResponse.fileName;
|
||||
currentResponse.lineNumber = reportedResponse.lineNumber;
|
||||
currentResponse.textPosition = reportedResponse.textPosition;
|
||||
Breakpoint bp = sub->breakpoint();
|
||||
QTC_ASSERT(bp, continue);
|
||||
formatCdbBreakPointResponse(bp->modelId(), responseId, currentResponse, str);
|
||||
|
||||
@@ -161,7 +161,8 @@ QString cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
|
||||
str << '`';
|
||||
if (!params.module.isEmpty())
|
||||
str << params.module << '!';
|
||||
str << cdbBreakPointFileName(params, sourcePathMapping) << ':' << params.lineNumber << '`';
|
||||
str << cdbBreakPointFileName(params, sourcePathMapping)
|
||||
<< ':' << params.textPosition.line << '`';
|
||||
break;
|
||||
case WatchpointAtAddress: { // Read/write, no space here
|
||||
const unsigned size = params.size ? params.size : 1;
|
||||
|
||||
@@ -281,7 +281,7 @@ static QJsonObject createBreakpoint(const Breakpoint &breakpoint)
|
||||
return QJsonObject();
|
||||
|
||||
QJsonObject bp;
|
||||
bp["line"] = params.lineNumber;
|
||||
bp["line"] = params.textPosition.line;
|
||||
bp["source"] = QJsonObject{{"name", params.fileName.fileName()},
|
||||
{"path", params.fileName.path()}};
|
||||
return bp;
|
||||
@@ -622,7 +622,7 @@ void DapEngine::handleOutput(const QJsonDocument &data)
|
||||
QString id = QString::number(body.value("hitBreakpointIds").toArray().first().toInteger());
|
||||
const BreakpointParameters ¶ms
|
||||
= breakHandler()->findBreakpointByResponseId(id)->requestedParameters();
|
||||
gotoLocation(Location(params.fileName, params.lineNumber));
|
||||
gotoLocation(Location(params.fileName, params.textPosition));
|
||||
}
|
||||
|
||||
if (state() == InferiorStopRequested)
|
||||
|
||||
@@ -142,7 +142,7 @@ static bool debuggerActionsEnabledHelper(DebuggerState state)
|
||||
Location::Location(const StackFrame &frame, bool marker)
|
||||
{
|
||||
m_fileName = frame.file;
|
||||
m_lineNumber = frame.line;
|
||||
m_textPosition = {frame.line, -1};
|
||||
m_needsMarker = marker;
|
||||
m_functionName = frame.function;
|
||||
m_hasDebugInfo = frame.isUsable();
|
||||
@@ -1075,7 +1075,7 @@ void DebuggerEngine::gotoLocation(const Location &loc)
|
||||
return;
|
||||
}
|
||||
const FilePath file = loc.fileName();
|
||||
const int line = loc.lineNumber();
|
||||
const int line = loc.textPosition().line;
|
||||
bool newEditor = false;
|
||||
IEditor *editor = EditorManager::openEditor(file,
|
||||
Id(),
|
||||
|
||||
@@ -219,12 +219,14 @@ public:
|
||||
Location(quint64 address) { m_address = address; }
|
||||
Location(const Utils::FilePath &file) { m_fileName = file; }
|
||||
Location(const Utils::FilePath &file, int line, bool marker = true)
|
||||
{ m_lineNumber = line; m_fileName = file; m_needsMarker = marker; }
|
||||
{ m_textPosition = {line, -1}; m_fileName = file; m_needsMarker = marker; }
|
||||
Location(const Utils::FilePath &file, const Utils::Text::Position &pos, bool marker = true)
|
||||
{ m_textPosition = pos; m_fileName = file; m_needsMarker = marker; }
|
||||
Location(const StackFrame &frame, bool marker = true);
|
||||
Utils::FilePath fileName() const { return m_fileName; }
|
||||
QString functionName() const { return m_functionName; }
|
||||
QString from() const { return m_from; }
|
||||
int lineNumber() const { return m_lineNumber; }
|
||||
Utils::Text::Position textPosition() const { return m_textPosition; }
|
||||
void setNeedsRaise(bool on) { m_needsRaise = on; }
|
||||
void setNeedsMarker(bool on) { m_needsMarker = on; }
|
||||
void setFileName(const Utils::FilePath &fileName) { m_fileName = fileName; }
|
||||
@@ -240,7 +242,7 @@ private:
|
||||
bool m_needsMarker = false;
|
||||
bool m_needsRaise = true;
|
||||
bool m_hasDebugInfo = true;
|
||||
int m_lineNumber = -1;
|
||||
Utils::Text::Position m_textPosition;
|
||||
Utils::FilePath m_fileName;
|
||||
QString m_functionName;
|
||||
QString m_from;
|
||||
|
||||
@@ -78,7 +78,25 @@ private:
|
||||
const GuardLocker locker(m_ignoreChanges);
|
||||
m_comboBox->clear();
|
||||
m_comboBox->addItem(Tr::tr("None"), QString());
|
||||
for (const DebuggerItem &item : DebuggerItemManager::debuggers())
|
||||
|
||||
IDeviceConstPtr device = BuildDeviceKitAspect::device(kit());
|
||||
const Utils::FilePath path = device->rootPath();
|
||||
const QList<DebuggerItem> list = DebuggerItemManager::debuggers();
|
||||
|
||||
const QList<DebuggerItem> same = Utils::filtered(list, [path](const DebuggerItem &item) {
|
||||
return item.command().isSameDevice(path);
|
||||
});
|
||||
const QList<DebuggerItem> other = Utils::filtered(list, [path](const DebuggerItem &item) {
|
||||
return !item.command().isSameDevice(path);
|
||||
});
|
||||
|
||||
for (const DebuggerItem &item : same)
|
||||
m_comboBox->addItem(item.displayName(), item.id());
|
||||
|
||||
if (!same.isEmpty() && !other.isEmpty())
|
||||
m_comboBox->insertSeparator(m_comboBox->count());
|
||||
|
||||
for (const DebuggerItem &item : other)
|
||||
m_comboBox->addItem(item.displayName(), item.id());
|
||||
|
||||
const DebuggerItem *item = DebuggerKitAspect::debugger(m_kit);
|
||||
|
||||
@@ -603,8 +603,8 @@ public:
|
||||
} else {
|
||||
//: Message tracepoint: %1 file, %2 line %3 function hit.
|
||||
message = Tr::tr("%1:%2 %3() hit").arg(data.fileName.fileName()).
|
||||
arg(data.lineNumber).
|
||||
arg(cppFunctionAt(data.fileName, data.lineNumber));
|
||||
arg(data.textPosition.line).
|
||||
arg(cppFunctionAt(data.fileName, data.textPosition.line));
|
||||
}
|
||||
QInputDialog dialog; // Create wide input dialog.
|
||||
dialog.setWindowFlags(dialog.windowFlags() & ~(Qt::MSWindowsFixedSizeDialogHint));
|
||||
@@ -1881,7 +1881,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
|
||||
if (engine->hasCapability(RunToLineCapability)) {
|
||||
auto act = menu->addAction(args.address
|
||||
? Tr::tr("Run to Address 0x%1").arg(args.address, 0, 16)
|
||||
: Tr::tr("Run to Line %1").arg(args.lineNumber));
|
||||
: Tr::tr("Run to Line %1").arg(args.textPosition.line));
|
||||
connect(act, &QAction::triggered, this, [args, engine] {
|
||||
QTC_ASSERT(engine, return);
|
||||
engine->executeRunToLine(args);
|
||||
@@ -1890,7 +1890,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
|
||||
if (engine->hasCapability(JumpToLineCapability)) {
|
||||
auto act = menu->addAction(args.address
|
||||
? Tr::tr("Jump to Address 0x%1").arg(args.address, 0, 16)
|
||||
: Tr::tr("Jump to Line %1").arg(args.lineNumber));
|
||||
: Tr::tr("Jump to Line %1").arg(args.textPosition.line));
|
||||
connect(act, &QAction::triggered, this, [args, engine] {
|
||||
QTC_ASSERT(engine, return);
|
||||
engine->executeJumpToLine(args);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <QVector>
|
||||
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/textutils.h>
|
||||
|
||||
namespace Utils { class ProcessHandle; }
|
||||
|
||||
@@ -326,7 +327,7 @@ public:
|
||||
public:
|
||||
LocationType type = UnknownLocation;
|
||||
Utils::FilePath fileName;
|
||||
int lineNumber = 0;
|
||||
Utils::Text::Position textPosition;
|
||||
quint64 address = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -1123,7 +1123,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
||||
const GdbMi frame = data["frame"];
|
||||
|
||||
// Jump over well-known frames.
|
||||
static int stepCounter = 0;
|
||||
//static int stepCounter = 0;
|
||||
if (debuggerSettings()->skipKnownFrames.value()) {
|
||||
if (reason == "end-stepping-range" || reason == "function-finished") {
|
||||
//showMessage(frame.toString());
|
||||
@@ -1131,19 +1131,19 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
||||
QString fileName = frame["file"].data();
|
||||
if (isLeavableFunction(funcName, fileName)) {
|
||||
//showMessage(_("LEAVING ") + funcName);
|
||||
++stepCounter;
|
||||
//++stepCounter;
|
||||
executeStepOut();
|
||||
return;
|
||||
}
|
||||
if (isSkippableFunction(funcName, fileName)) {
|
||||
//showMessage(_("SKIPPING ") + funcName);
|
||||
++stepCounter;
|
||||
//++stepCounter;
|
||||
executeStepIn(false);
|
||||
return;
|
||||
}
|
||||
//if (stepCounter)
|
||||
// qDebug() << "STEPCOUNTER:" << stepCounter;
|
||||
stepCounter = 0;
|
||||
//stepCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1211,9 +1211,9 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
||||
if (Breakpoint bp = breakHandler()->findBreakpointByResponseId(nr)) {
|
||||
const FilePath &bpFileName = bp->fileName();
|
||||
if (!bpFileName.isEmpty())
|
||||
bp->setMarkerFileAndLine(bpFileName, lineNumber);
|
||||
bp->setMarkerFileAndPosition(bpFileName, {lineNumber, -1});
|
||||
else if (!fileName.isEmpty())
|
||||
bp->setMarkerFileAndLine(fileName, lineNumber);
|
||||
bp->setMarkerFileAndPosition(fileName, {lineNumber, -1});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1946,13 +1946,13 @@ void GdbEngine::executeRunToLine(const ContextData &data)
|
||||
CHECK_STATE(InferiorStopOk);
|
||||
setTokenBarrier();
|
||||
notifyInferiorRunRequested();
|
||||
showStatusMessage(Tr::tr("Run to line %1 requested...").arg(data.lineNumber), 5000);
|
||||
showStatusMessage(Tr::tr("Run to line %1 requested...").arg(data.textPosition.line), 5000);
|
||||
#if 1
|
||||
QString loc;
|
||||
if (data.address)
|
||||
loc = addressSpec(data.address);
|
||||
else
|
||||
loc = '"' + breakLocation(data.fileName) + '"' + ':' + QString::number(data.lineNumber);
|
||||
loc = '"' + breakLocation(data.fileName) + '"' + ':' + QString::number(data.textPosition.line);
|
||||
runCommand({"tbreak " + loc});
|
||||
|
||||
runCommand({"continue", NativeCommand|RunRequest, CB(handleExecuteRunToLine)});
|
||||
@@ -1980,7 +1980,7 @@ void GdbEngine::executeJumpToLine(const ContextData &data)
|
||||
if (data.address)
|
||||
loc = addressSpec(data.address);
|
||||
else
|
||||
loc = '"' + breakLocation(data.fileName) + '"' + ':' + QString::number(data.lineNumber);
|
||||
loc = '"' + breakLocation(data.fileName) + '"' + ':' + QString::number(data.textPosition.line);
|
||||
runCommand({"tbreak " + loc});
|
||||
notifyInferiorRunRequested();
|
||||
|
||||
@@ -2086,7 +2086,7 @@ QString GdbEngine::breakpointLocation(const BreakpointParameters &data)
|
||||
// The argument is simply a C-quoted version of the argument to the
|
||||
// non-MI "break" command, including the "original" quoting it wants.
|
||||
return "\"\\\"" + GdbMi::escapeCString(fileName) + "\\\":"
|
||||
+ QString::number(data.lineNumber) + '"';
|
||||
+ QString::number(data.textPosition.line) + '"';
|
||||
}
|
||||
|
||||
QString GdbEngine::breakpointLocation2(const BreakpointParameters &data)
|
||||
@@ -2097,7 +2097,7 @@ QString GdbEngine::breakpointLocation2(const BreakpointParameters &data)
|
||||
|
||||
const QString fileName = usage == BreakpointUseFullPath
|
||||
? data.fileName.path() : breakLocation(data.fileName);
|
||||
return GdbMi::escapeCString(fileName) + ':' + QString::number(data.lineNumber);
|
||||
return GdbMi::escapeCString(fileName) + ':' + QString::number(data.textPosition.line);
|
||||
}
|
||||
|
||||
void GdbEngine::handleInsertInterpreterBreakpoint(const DebuggerResponse &response,
|
||||
@@ -2236,7 +2236,7 @@ void GdbEngine::handleBreakInsert1(const DebuggerResponse &response, const Break
|
||||
// Older version of gdb don't know the -a option to set tracepoints
|
||||
// ^error,msg="mi_cmd_break_insert: Unknown option ``a''"
|
||||
const QString fileName = bp->fileName().toString();
|
||||
const int lineNumber = bp->lineNumber();
|
||||
const int lineNumber = bp->textPosition().line;
|
||||
DebuggerCommand cmd("trace \"" + GdbMi::escapeCString(fileName) + "\":"
|
||||
+ QString::number(lineNumber),
|
||||
NeedsTemporaryStop);
|
||||
|
||||
@@ -416,7 +416,7 @@ void LldbEngine::executeRunToLine(const ContextData &data)
|
||||
notifyInferiorRunRequested();
|
||||
DebuggerCommand cmd("executeRunToLocation");
|
||||
cmd.arg("file", data.fileName.path());
|
||||
cmd.arg("line", data.lineNumber);
|
||||
cmd.arg("line", data.textPosition.line);
|
||||
cmd.arg("address", data.address);
|
||||
runCommand(cmd);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ void LldbEngine::executeJumpToLine(const ContextData &data)
|
||||
{
|
||||
DebuggerCommand cmd("executeJumpToLocation");
|
||||
cmd.arg("file", data.fileName.path());
|
||||
cmd.arg("line", data.lineNumber);
|
||||
cmd.arg("line", data.textPosition.line);
|
||||
cmd.arg("address", data.address);
|
||||
runCommand(cmd);
|
||||
}
|
||||
@@ -561,7 +561,7 @@ void LldbEngine::updateBreakpointData(const Breakpoint &bp, const GdbMi &bkpt, b
|
||||
bp->setCondition(fromHex(bkpt["condition"].data()));
|
||||
bp->setHitCount(bkpt["hitcount"].toInt());
|
||||
bp->setFileName(FilePath::fromUserInput(bkpt["file"].data()));
|
||||
bp->setLineNumber(bkpt["line"].toInt());
|
||||
bp->setTextPosition({bkpt["line"].toInt(), -1});
|
||||
|
||||
GdbMi locations = bkpt["locations"];
|
||||
const int numChild = locations.childCount();
|
||||
@@ -574,7 +574,7 @@ void LldbEngine::updateBreakpointData(const Breakpoint &bp, const GdbMi &bkpt, b
|
||||
loc->params.address = location["addr"].toAddress();
|
||||
loc->params.functionName = location["function"].data();
|
||||
loc->params.fileName = FilePath::fromUserInput(location["file"].data());
|
||||
loc->params.lineNumber = location["line"].toInt();
|
||||
loc->params.textPosition.line = location["line"].toInt();
|
||||
loc->displayName = QString("%1.%2").arg(bp->responseId()).arg(locid);
|
||||
}
|
||||
bp->setPending(false);
|
||||
|
||||
@@ -220,7 +220,7 @@ void PdbEngine::insertBreakpoint(const Breakpoint &bp)
|
||||
if (params.type == BreakpointByFunction)
|
||||
loc = params.functionName;
|
||||
else
|
||||
loc = params.fileName.toString() + ':' + QString::number(params.lineNumber);
|
||||
loc = params.fileName.toString() + ':' + QString::number(params.textPosition.line);
|
||||
|
||||
postDirectCommand("break " + loc);
|
||||
}
|
||||
@@ -476,7 +476,7 @@ void PdbEngine::handleOutput2(const QString &data)
|
||||
QTC_ASSERT(bp, continue);
|
||||
bp->setResponseId(bpnr);
|
||||
bp->setFileName(fileName);
|
||||
bp->setLineNumber(lineNumber);
|
||||
bp->setTextPosition({lineNumber, -1});
|
||||
bp->adjustMarker();
|
||||
bp->setPending(false);
|
||||
notifyBreakpointInsertOk(bp);
|
||||
|
||||
@@ -603,10 +603,10 @@ void QmlEngine::executeRunToLine(const ContextData &data)
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||
showStatusMessage(Tr::tr("Run to line %1 (%2) requested...")
|
||||
.arg(data.lineNumber)
|
||||
.arg(data.textPosition.line)
|
||||
.arg(data.fileName.toString()),
|
||||
5000);
|
||||
d->setBreakpoint(SCRIPTREGEXP, data.fileName.toString(), true, data.lineNumber);
|
||||
d->setBreakpoint(SCRIPTREGEXP, data.fileName.toString(), true, data.textPosition.line);
|
||||
clearExceptionSelection();
|
||||
d->continueDebugging(Continue);
|
||||
|
||||
@@ -658,7 +658,7 @@ void QmlEngine::insertBreakpoint(const Breakpoint &bp)
|
||||
|
||||
} else if (requested.type == BreakpointByFileAndLine) {
|
||||
d->setBreakpoint(SCRIPTREGEXP, requested.fileName.toString(),
|
||||
requested.enabled, requested.lineNumber, 0,
|
||||
requested.enabled, requested.textPosition.line, 0,
|
||||
requested.condition, requested.ignoreCount);
|
||||
|
||||
} else if (requested.type == BreakpointOnQmlSignalEmit) {
|
||||
@@ -716,7 +716,7 @@ void QmlEngine::updateBreakpoint(const Breakpoint &bp)
|
||||
} else {
|
||||
d->clearBreakpoint(bp);
|
||||
d->setBreakpoint(SCRIPTREGEXP, requested.fileName.toString(),
|
||||
requested.enabled, requested.lineNumber, 0,
|
||||
requested.enabled, requested.textPosition.line, 0,
|
||||
requested.condition, requested.ignoreCount);
|
||||
d->breakpointsSync.insert(d->sequence, bp);
|
||||
}
|
||||
@@ -776,7 +776,7 @@ void QmlEngine::assignValueInDebugger(WatchItem *item,
|
||||
const QString &expression, const QVariant &editValue)
|
||||
{
|
||||
if (!expression.isEmpty()) {
|
||||
QTC_CHECK(editValue.type() == QVariant::String);
|
||||
QTC_CHECK(editValue.typeId() == QVariant::String);
|
||||
QVariant value;
|
||||
QString val = editValue.toString();
|
||||
if (item->type == "boolean")
|
||||
@@ -855,7 +855,7 @@ static ConsoleItem *constructLogItemTree(const QVariant &result,
|
||||
|
||||
QString text;
|
||||
ConsoleItem *item = nullptr;
|
||||
if (result.type() == QVariant::Map) {
|
||||
if (result.typeId() == QVariant::Map) {
|
||||
if (key.isEmpty())
|
||||
text = "Object";
|
||||
else
|
||||
@@ -1727,7 +1727,7 @@ void QmlEnginePrivate::messageReceived(const QByteArray &data)
|
||||
//The breakpoint requested line should be same as
|
||||
//actual line
|
||||
if (bp && bp->state() != BreakpointInserted) {
|
||||
bp->setLineNumber(line);
|
||||
bp->setTextPosition({line, -1});
|
||||
bp->setPending(false);
|
||||
engine->notifyBreakpointInsertOk(bp);
|
||||
}
|
||||
@@ -1865,7 +1865,7 @@ void QmlEnginePrivate::messageReceived(const QByteArray &data)
|
||||
setBreakpoint(SCRIPTREGEXP,
|
||||
params.fileName.toString(),
|
||||
params.enabled,
|
||||
params.lineNumber,
|
||||
params.textPosition.line,
|
||||
newColumn,
|
||||
params.condition,
|
||||
params.ignoreCount);
|
||||
@@ -1889,7 +1889,7 @@ void QmlEnginePrivate::messageReceived(const QByteArray &data)
|
||||
bp->setFunctionName(invocationText);
|
||||
}
|
||||
if (bp->state() != BreakpointInserted) {
|
||||
bp->setLineNumber(breakData.value("sourceLine").toInt() + 1);
|
||||
bp->setTextPosition({breakData.value("sourceLine").toInt() + 1, -1});
|
||||
bp->setPending(false);
|
||||
engine->notifyBreakpointInsertOk(bp);
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
|
||||
|
||||
if (m_objectTreeQueryIds.contains(queryId)) {
|
||||
m_objectTreeQueryIds.removeOne(queryId);
|
||||
if (value.type() == QVariant::List) {
|
||||
if (value.typeId() == QVariant::List) {
|
||||
const QVariantList objList = value.toList();
|
||||
for (const QVariant &var : objList) {
|
||||
// TODO: check which among the list is the actual
|
||||
@@ -289,7 +289,7 @@ static void sortChildrenIfNecessary(WatchItem *propertiesWatch)
|
||||
|
||||
static bool insertChildren(WatchItem *parent, const QVariant &value)
|
||||
{
|
||||
switch (value.type()) {
|
||||
switch (value.typeId()) {
|
||||
case QVariant::Map: {
|
||||
const QVariantMap map = value.toMap();
|
||||
for (auto it = map.begin(), end = map.end(); it != end; ++it) {
|
||||
|
||||
@@ -315,14 +315,14 @@ ContextData getLocationContext(TextDocument *document, int lineNumber)
|
||||
if (ln > 0) {
|
||||
data.type = LocationByFile;
|
||||
data.fileName = Utils::FilePath::fromString(fileName);
|
||||
data.lineNumber = ln;
|
||||
data.textPosition.line = ln;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data.type = LocationByFile;
|
||||
data.fileName = document->filePath();
|
||||
data.lineNumber = lineNumber;
|
||||
data.textPosition.line = lineNumber;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -381,13 +381,13 @@ static void setValueAnnotationsHelper(BaseTextEditor *textEditor,
|
||||
if (!cppDocument) // For non-C++ documents.
|
||||
return;
|
||||
|
||||
const int firstLine = firstRelevantLine(cppDocument, loc.lineNumber(), 1);
|
||||
const int firstLine = firstRelevantLine(cppDocument, loc.textPosition().line, 1);
|
||||
if (firstLine < 1)
|
||||
return;
|
||||
|
||||
CPlusPlus::ExpressionUnderCursor expressionUnderCursor(cppDocument->languageFeatures());
|
||||
QTextCursor tc = widget->textCursor();
|
||||
for (int lineNumber = loc.lineNumber(); lineNumber >= firstLine; --lineNumber) {
|
||||
for (int lineNumber = loc.textPosition().line; lineNumber >= firstLine; --lineNumber) {
|
||||
const QTextBlock block = textDocument->document()->findBlockByNumber(lineNumber - 1);
|
||||
tc.setPosition(block.position());
|
||||
for (; !tc.atBlockEnd(); tc.movePosition(QTextCursor::NextCharacter)) {
|
||||
|
||||
@@ -359,7 +359,7 @@ void UvscEngine::insertBreakpoint(const Breakpoint &bp)
|
||||
// Add file name.
|
||||
expression += "\\" + requested.fileName.toString();
|
||||
// Add line number.
|
||||
expression += "\\" + QString::number(requested.lineNumber);
|
||||
expression += "\\" + QString::number(requested.textPosition.line);
|
||||
}
|
||||
|
||||
handleInsertBreakpoint(expression, bp);
|
||||
@@ -777,7 +777,7 @@ void UvscEngine::handleInsertBreakpoint(const QString &exp, const Breakpoint &bp
|
||||
bp->setPending(false);
|
||||
bp->setResponseId(QString::number(tickMark));
|
||||
bp->setAddress(address);
|
||||
bp->setLineNumber(line);
|
||||
bp->setTextPosition(Text::Position{int(line), -1});
|
||||
bp->setFileName(FilePath::fromString(fileName));
|
||||
bp->setFunctionName(function);
|
||||
notifyBreakpointInsertOk(bp);
|
||||
|
||||
@@ -73,8 +73,8 @@ QByteArray encodeBreakPoint(BKTYPE type, const QString &exp, const QString &cmd)
|
||||
bkPtr->type = type;
|
||||
bkPtr->count = 1;
|
||||
bkPtr->accessSize = 0;
|
||||
bkPtr->expressionLength = asciiExp.count() + 1;
|
||||
bkPtr->commandLength = asciiCmd.count() + 1;
|
||||
bkPtr->expressionLength = asciiExp.size() + 1;
|
||||
bkPtr->commandLength = asciiCmd.size() + 1;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ QString adjustHexValue(QString hex, const QString &type)
|
||||
return QString::number(v);
|
||||
} else {
|
||||
const bool isUnsigned = type.startsWith("unsigned");
|
||||
switch (data.count()) {
|
||||
switch (data.size()) {
|
||||
case 1:
|
||||
if (isUnsigned) {
|
||||
quint8 v = 0;
|
||||
|
||||
@@ -86,7 +86,7 @@ void FormEditorPlugin::initialize()
|
||||
if (!locale.isEmpty()) {
|
||||
auto qtr = new QTranslator(this);
|
||||
const QString creatorTrPath = ICore::resourcePath("translations").toString();
|
||||
const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
const QString qtTrPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||
const QString trFile = "designer_" + locale;
|
||||
if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))
|
||||
QCoreApplication::installTranslator(qtr);
|
||||
|
||||
@@ -128,7 +128,7 @@ DiffFilesController::DiffFilesController(IDocument *document)
|
||||
outputList->resize(inputList.size());
|
||||
|
||||
using namespace std::placeholders;
|
||||
QList<TaskItem> tasks {parallel, finishAllAndDone};
|
||||
QList<GroupItem> tasks {parallel, finishAllAndDone};
|
||||
for (int i = 0; i < inputList.size(); ++i) {
|
||||
tasks.append(AsyncTask<FileData>(std::bind(setupDiff, _1, inputList.at(i)),
|
||||
std::bind(onDiffDone, _1, i)));
|
||||
|
||||
@@ -441,7 +441,7 @@ ShowController::ShowController(IDocument *document, const QString &id)
|
||||
};
|
||||
|
||||
using namespace std::placeholders;
|
||||
QList<TaskItem> tasks {parallel, continueOnDone, onGroupError(onFollowsError)};
|
||||
QList<GroupItem> tasks {parallel, continueOnDone, onGroupError(onFollowsError)};
|
||||
for (int i = 0, total = parents.size(); i < total; ++i) {
|
||||
tasks.append(ProcessTask(std::bind(setupFollow, _1, parents.at(i)),
|
||||
std::bind(onFollowDone, _1, i)));
|
||||
|
||||
@@ -182,7 +182,7 @@ HelpPluginPrivate::HelpPluginPrivate()
|
||||
auto qtr = new QTranslator(this);
|
||||
auto qhelptr = new QTranslator(this);
|
||||
const QString creatorTrPath = ICore::resourcePath("translations").toString();
|
||||
const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
const QString qtTrPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||
const QString trFile = QLatin1String("assistant_") + locale;
|
||||
const QString helpTrFile = QLatin1String("qt_help_") + locale;
|
||||
if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))
|
||||
|
||||