Merge remote-tracking branch 'origin/14.0'

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs

Change-Id: I325f21db9bac247a02cb14452f190b378147f581
This commit is contained in:
Eike Ziller
2024-06-17 13:54:25 +02:00
38 changed files with 377 additions and 135 deletions

View File

@@ -51,9 +51,12 @@ Editing
([QTCREATORBUG-12190](https://bugreports.qt.io/browse/QTCREATORBUG-12190))
* Added `Re-order Member Function Definitions According to Declaration Order`
([QTCREATORBUG-6199](https://bugreports.qt.io/browse/QTCREATORBUG-6199))
* Added triggers for `Add Curly Braces`
* Added `Add Curly Braces` for do, while, and for loops
* Fixed issues with macros
([QTCREATORBUG-10279](https://bugreports.qt.io/browse/QTCREATORBUG-10279))
[Documentation](https://doc.qt.io/qtcreator/creator-reference-cpp-quick-fixes.html)
* Clangd
* Increased the minimum version to LLVM 17
* Added the `Per-project index location` and `Per-session index location`
@@ -83,7 +86,8 @@ Editing
* Improved support for enums
([QTCREATORBUG-19226](https://bugreports.qt.io/browse/QTCREATORBUG-19226))
* Added `Qt Design Studio` to `Open With` for `.ui.qml`-files
* Added `Qt Design Studio` to `Open With` for `.ui.qml` files
([Documentation](https://doc.qt.io/qtcreator/creator-quick-ui-forms.html))
* Language Server
* Switched on by default
* Added option for generating `qmlls.ini` files for CMake projects
@@ -94,7 +98,8 @@ Editing
### Python
* Added the option to install Python LSP updates
* Added options for updating Python Language Server
([Documentation] (https://doc-snapshots.qt.io/qtcreator-14.0/creator-language-servers.html))
### Language Server Protocol

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@@ -115,7 +115,7 @@
\row
\li Assign to Local Variable
\li Adds a local variable which stores the return value of a
function call or a new expression. For example, rewrites:
function call or a new expression. For example, rewrites
\code
QString s;
@@ -195,7 +195,7 @@
\row
\li Move All Function Definitions
\li Moves all function definitions to the implementation file or
outside the class. For example, rewrites:
outside the class. For example, rewrites
\code
class Foo
{
@@ -281,12 +281,14 @@
\li Description
\row
\li Add Curly Braces
\li Adds curly braces to an if statement that does not have a
compound statement. For example, rewrites
\li Adds curly braces to an if clause or to a do, while, or for
loop. For example, rewrites an if clause
\code
if (a)
b;
else
c;
\endcode
as
@@ -294,6 +296,54 @@
\code
if (a) {
b;
} else {
c;
}
\endcode
Rewrites a do loop
\code
do
++i;
while (i < 10);
\endcode
as
\code
do {
++i;
} while (i < 10);
\endcode
Rewrites a while loop
\code
while (i > 0)
--i;
\endcode
as
\code
while (i > 0) {
--i;
}
\endcode
Rewrites a for loop
\code
for (int i = 0; i < 10; ++i)
func(i);
\endcode
as
\code
for (int i = 0; i < 10; ++i) {
func(i);
}
\endcode
\row
@@ -321,7 +371,7 @@
post-decrement operators as pre-decrement operators. It also
moves other than string or numeric literals and id expressions
from the condition of a for loop to its initializer. For
example, rewrites:
example, rewrites
\code
for (int i = 0; i < 3 * 2; i++)
@@ -411,15 +461,66 @@
\inlineimage icons/refactormarker.png
\row
\li Convert Function Call to Qt Meta-Method Invocation
\li Converts a normal function call into a meta method invocation, if
the function is marked as invokable.
\li Converts an invokable function call into a meta method
invocation. This applies to signals and slots in general,
as well as functions explicitly marked with \c Q_INVOKABLE.
For example, for the following class:
\code
class Foo : public QObject
{
Q_OBJECT
public:
explicit Foo(QObject *parent = nullptr);
Q_SLOT void pubBar(int i);
private:
Q_INVOKABLE void bar(int i, const QString &c);
};
\endcode
rewrites
\code
Foo::Foo(QObject *parent)
: QObject{parent}
{
this->bar(42, QString("answer"));
}
\endcode
as
\code
Foo::Foo(QObject *parent)
: QObject{parent}
{
QMetaObject::invokeMethod(this, "bar", Q_ARG(int, 42), Q_ARG(QString, QString("answer")));
}
\endcode
The quick fix also works on invokable methods outside the class that are
visible from the location where they are called from. For example, it
rewrites
\code
Foo f;
f.pubBar(123);
\endcode
as
\code
Foo f;
QMetaObject::invokeMethod(&f, "pubBar", Q_ARG(int, 123));
\endcode
\row
\li Move Definition Here
\li Moves an existing function definition to its declaration.
\row
\li Move Function Definition
\li Moves a function definition to the implementation file, outside
the class or back to its declaration. For example, rewrites:
the class or back to its declaration. For example, rewrites
\code
class Foo
{
@@ -504,7 +605,7 @@
\row
\li Rewrite Condition Using ||
\li Rewrites the expression according to De Morgan's laws. For
example, rewrites:
example, rewrites
\code
!a && !b
\endcode
@@ -518,7 +619,7 @@
\row
\li Rewrite Using \e operator
\li Rewrites an expression negating it and using the inverse
operator. For example, rewrites:
operator. For example, rewrites
\list
@@ -558,7 +659,7 @@
\row
\li Split if Statement
\li Splits an if statement into several statements. For example,
rewrites:
rewrites
\code
if (something && something_else) {
@@ -594,7 +695,7 @@
\row
\li Swap Operands
\li Rewrites an expression in the inverse order using the inverse
operator. For example, rewrites:
operator. For example, rewrites
\code
a op b
\endcode
@@ -750,7 +851,7 @@
\row
\li Convert to Pointer
\li Converts the selected stack variable to a pointer. For example,
rewrites:
rewrites
\code
QByteArray foo = "foo";
@@ -771,7 +872,7 @@
\row
\li Convert to Stack Variable
\li Converts the selected pointer to a stack variable. For example,
rewrites:
rewrites
\code
QByteArray *foo = new QByteArray("foo");
@@ -796,7 +897,7 @@
project is open, the current global code style settings are
used.
For example, rewrites:
For example, rewrites
\code
char*s;
@@ -816,7 +917,7 @@
\row
\li Split Declaration
\li Splits a simple declaration into several declarations. For
example, rewrites:
example, rewrites
\code
int *a, b;
\endcode

View File

@@ -36,6 +36,7 @@
\l{Outline} view or in the \uicontrol Symbols list on the
\l{Edit Mode}{editor toolbar}
\li \l{Call Hierarchy}{Viewing the callers and callees of a function}
\li \l{Type Hierarchy}{Viewing the base classes and derived classes of a class}
\li \l{Find references to a symbol}{Finding references to symbols}
\li \l{Rename symbols}{Renaming the symbol under the cursor}
\li Code actions
@@ -90,6 +91,19 @@
To remove language servers from the list, select \uicontrol Delete.
\section1 Updating Python Language Server
\QC offers to update the Python language server when you open a Python
file in the editor.
\image qtcreator-python-update-language-server.webp {Message about updating Python Language Server}
To update the language server, select \uicontrol Update. To save your choice,
select \uicontrol {Always Update}.
To skip updating and hide the message for future updates, select
\uicontrol Never.
\section1 Supported Locator Filters
The locator enables you to browse not only files, but any items defined by

View File

@@ -23,14 +23,18 @@
\brief Limitations of \QDS UI files (.ui.qml).
\if defined(qtdesignstudio)
You can use \QDS wizards to create UI files that have the filename
extension \e .ui.qml. The UI files can be edited in the \l {2D} view.
If you use the \l {Code} view to add code that is not supported
by the \uicontrol {2D} view, \QDS displays error messages.
\QDS wizards create UI files that have the filename extension \e .ui.qml.
Edit the UI files in the \l {2D} view.
If you use the \l {Code} view to add code that the \uicontrol {2D} view does
not support, \QDS displays error messages.
\else
If you switch between \QC and \QDS or cooperate with designers on
a project, you might encounter UI files (.ui.qml). They are intended to
be edited in \QDS only.
To open UI files with \QDS, select \uicontrol {Open With} >
\uicontrol {\QDS} in the context menu for the file.
\endif

View File

@@ -1072,7 +1072,6 @@ class DumperBase():
def check_typeid(self, typeid):
if not isinstance(typeid, int):
size = self.type_size_cache.get(typeid, None)
raise RuntimeError('WRONG TYPE FOR TYPEID: %s %s' % (str(typeid), type(typeid)))
def checkRef(self, ref):

View File

@@ -462,14 +462,17 @@ static bool isFileIncluded(const QList<QRegularExpression> &filterRegs,
return isIncluded && (exclusionRegs.isEmpty() || !matches(exclusionRegs, filePath));
}
std::function<FilePaths(const FilePaths &)> filterFilesFunction(const QStringList &filters,
const QStringList &exclusionFilters)
FilterFilesFunction filterFilesFunction(const QStringList &filters,
const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion)
{
const QList<QRegularExpression> filterRegs = filtersToRegExps(filters);
const QList<QRegularExpression> exclusionRegs = filtersToRegExps(exclusionFilters);
return [filterRegs, exclusionRegs](const FilePaths &filePaths) {
return Utils::filtered(filePaths, [&filterRegs, &exclusionRegs](const FilePath &filePath) {
return isFileIncluded(filterRegs, exclusionRegs, filePath);
return [filterRegs, exclusionRegs, filterFileFuntion](const FilePaths &filePaths) {
return Utils::filtered(filePaths, [&filterRegs, &exclusionRegs, filterFileFuntion](
const FilePath &filePath) {
return isFileIncluded(filterRegs, exclusionRegs, filePath) &&
(!filterFileFuntion || filterFileFuntion(filePath));
});
};
}
@@ -583,12 +586,14 @@ const int s_progressMaximum = 1000;
struct SubDirCache
{
SubDirCache(const FilePaths &directories, const QStringList &filters,
const QStringList &exclusionFilters, QTextCodec *encoding);
const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion, QTextCodec *encoding);
std::optional<FileContainerIterator::Item> updateCache(int advanceIntoIndex,
const SubDirCache &initialCache);
std::function<FilePaths(const FilePaths &)> m_filterFiles;
FilterFilesFunction m_filterFilesFunction;
FilterFileFunction m_filterFileFunction;
QTextCodec *m_encoding = nullptr;
QStack<FilePath> m_dirs;
QSet<FilePath> m_knownDirs;
@@ -606,8 +611,10 @@ struct SubDirCache
};
SubDirCache::SubDirCache(const FilePaths &directories, const QStringList &filters,
const QStringList &exclusionFilters, QTextCodec *encoding)
: m_filterFiles(filterFilesFunction(filters, exclusionFilters))
const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion, QTextCodec *encoding)
: m_filterFilesFunction(filterFilesFunction(filters, exclusionFilters, filterFileFuntion))
, m_filterFileFunction(filterFileFuntion)
, m_encoding(encoding == nullptr ? QTextCodec::codecForLocale() : encoding)
{
const qreal maxPer = qreal(s_progressMaximum) / directories.count();
@@ -642,7 +649,7 @@ std::optional<FileContainerIterator::Item> SubDirCache::updateCache(int advanceI
const FilePath dir = m_dirs.pop();
const qreal dirProgressMax = m_progressValues.pop();
const bool processed = m_processedValues.pop();
if (dir.exists()) {
if (dir.exists() && (!m_filterFileFunction || m_filterFileFunction(dir))) {
using Dir = FilePath;
using CanonicalDir = FilePath;
std::vector<std::pair<Dir, CanonicalDir>> subDirs;
@@ -657,7 +664,7 @@ std::optional<FileContainerIterator::Item> SubDirCache::updateCache(int advanceI
}
if (subDirs.empty()) {
const FilePaths allFilePaths = dir.dirEntries(QDir::Files | QDir::Hidden);
const FilePaths filePaths = m_filterFiles(allFilePaths);
const FilePaths filePaths = m_filterFilesFunction(allFilePaths);
m_items.reserve(m_items.size() + filePaths.size());
Utils::reverseForeach(filePaths, [this](const FilePath &file) {
m_items.append({file, m_encoding});
@@ -706,15 +713,25 @@ static FileContainerIterator::Advancer subDirAdvancer(const SubDirCache &initial
}
static FileContainer::AdvancerProvider subDirAdvancerProvider(const FilePaths &directories,
const QStringList &filters, const QStringList &exclusionFilters, QTextCodec *encoding)
const QStringList &filters, const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion, QTextCodec *encoding)
{
const SubDirCache initialCache(directories, filters, exclusionFilters, encoding);
return [=] { return subDirAdvancer(initialCache); };
const SubDirCache initialCache(directories, filters, exclusionFilters, filterFileFuntion,
encoding);
return [initialCache] { return subDirAdvancer(initialCache); };
}
SubDirFileContainer::SubDirFileContainer(const FilePaths &directories, const QStringList &filters,
const QStringList &exclusionFilters, QTextCodec *encoding)
: FileContainer(subDirAdvancerProvider(directories, filters, exclusionFilters, encoding),
s_progressMaximum) {}
: FileContainer(subDirAdvancerProvider(directories, filters, exclusionFilters, {}, encoding),
s_progressMaximum)
{}
SubDirFileContainer::SubDirFileContainer(const FilePaths &directories,
const FilterFileFunction &filterFileFuntion,
QTextCodec *encoding)
: FileContainer(subDirAdvancerProvider(directories, {}, {}, filterFileFuntion, encoding),
s_progressMaximum)
{}
} // namespace Utils

View File

@@ -31,6 +31,9 @@ enum FindFlag {
};
Q_DECLARE_FLAGS(FindFlags, FindFlag)
using FilterFileFunction = std::function<bool(const FilePath &filePath)>;
using FilterFilesFunction = std::function<FilePaths(const FilePaths &filePath)>;
QTCREATOR_UTILS_EXPORT
QTextDocument::FindFlags textDocumentFlagsForFindFlags(FindFlags flags);
@@ -39,8 +42,9 @@ void searchInContents(QPromise<SearchResultItems> &promise, const QString &searc
FindFlags flags, const FilePath &filePath, const QString &contents);
QTCREATOR_UTILS_EXPORT
std::function<FilePaths(const FilePaths &)> filterFilesFunction(const QStringList &filters,
const QStringList &exclusionFilters);
FilterFilesFunction filterFilesFunction(const QStringList &filters,
const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion = {});
QTCREATOR_UTILS_EXPORT
QStringList splitFilterUiText(const QString &text);
@@ -150,9 +154,10 @@ public:
class QTCREATOR_UTILS_EXPORT SubDirFileContainer : public FileContainer
{
public:
SubDirFileContainer(const FilePaths &directories, const QStringList &filters,
const QStringList &exclusionFilters, QTextCodec *encoding = nullptr);
SubDirFileContainer(const FilePaths &directories,
const QStringList &filters,
const QStringList &exclusionFilters,
const FilterFileFunction &filterFileFuntion = {},
QTextCodec *encoding = nullptr);
};

View File

@@ -283,7 +283,7 @@ QVariant ParseContext::readSimpleValue(QXmlStreamReader &r, const QXmlStreamAttr
}
QVariant value;
value.setValue(text);
value.convert(QMetaType::type(type.toLatin1().constData()));
value.convert(QMetaType::fromName(type.toLatin1().constData()));
return value;
}

View File

@@ -16,8 +16,8 @@
#endif
#ifdef Q_OS_WIN
#include <psapi.h>
#include <windows.h>
#include <psapi.h>
#endif
#ifdef Q_OS_MACOS

View File

@@ -52,7 +52,9 @@ ManualRunDialog::ManualRunDialog(const ProjectExplorer::Project *project)
analyzeButton->setEnabled(m_model->hasCheckedFiles());
});
auto optionsWidget = settings().layouter()().emerge();
m_manualRunSettings.readSettings();
m_manualRunSettings.setAutoApply(true);
auto optionsWidget = m_manualRunSettings.layouter()().emerge();
auto layout = new QVBoxLayout(this);
layout->addWidget(optionsWidget);

View File

@@ -3,6 +3,8 @@
#pragma once
#include "cppchecksettings.h"
#include <QDialog>
namespace Utils {
@@ -25,8 +27,10 @@ public:
Utils::FilePaths filePaths() const;
QSize sizeHint() const override;
const CppcheckSettings &manualRunSettings() const { return m_manualRunSettings; }
private:
ProjectExplorer::SelectableFilesFromDirModel *m_model;
CppcheckSettings m_manualRunSettings;
};
} // Cppcheck::Internal

View File

@@ -56,9 +56,9 @@ public:
CppcheckPluginPrivate::CppcheckPluginPrivate()
{
tool.updateOptions();
tool.updateOptions(settings());
connect(&settings(), &AspectContainer::changed, this, [this] {
tool.updateOptions();
tool.updateOptions(settings());
trigger.recheck();
});
@@ -112,8 +112,6 @@ void CppcheckPluginPrivate::startManualRun()
if (!project)
return;
manualRunTool.updateOptions();
ManualRunDialog dialog(project);
if (dialog.exec() == ManualRunDialog::Rejected)
return;
@@ -125,7 +123,7 @@ void CppcheckPluginPrivate::startManualRun()
return;
manualRunTool.setProject(project);
manualRunTool.updateOptions();
manualRunTool.updateOptions(dialog.manualRunSettings());
manualRunTool.check(files);
perspective.select();
}

View File

@@ -39,10 +39,10 @@ CppcheckTool::CppcheckTool(CppcheckDiagnosticManager &manager, const Id &progres
CppcheckTool::~CppcheckTool() = default;
void CppcheckTool::updateOptions()
void CppcheckTool::updateOptions(const CppcheckSettings &settings)
{
m_filters.clear();
for (const QString &pattern : settings().ignoredPatterns().split(',')) {
for (const QString &pattern : settings.ignoredPatterns().split(',')) {
const QString trimmedPattern = pattern.trimmed();
if (trimmedPattern.isEmpty())
continue;
@@ -52,56 +52,54 @@ void CppcheckTool::updateOptions()
m_filters.push_back(re);
}
updateArguments();
updateArguments(settings);
}
void CppcheckTool::setProject(ProjectExplorer::Project *project)
{
m_project = project;
updateArguments();
updateArguments(settings());
}
void CppcheckTool::updateArguments()
void CppcheckTool::updateArguments(const CppcheckSettings &settings)
{
if (!m_project)
return;
m_cachedAdditionalArguments.clear();
CppcheckSettings &s = settings();
QStringList arguments;
if (!s.customArguments().isEmpty()) {
if (!settings.customArguments().isEmpty()) {
Utils::MacroExpander *expander = Utils::globalMacroExpander();
const QString expanded = expander->expand(s.customArguments());
const QString expanded = expander->expand(settings.customArguments());
arguments.push_back(expanded);
}
if (s.warning())
if (settings.warning())
arguments.push_back("--enable=warning");
if (s.style())
if (settings.style())
arguments.push_back("--enable=style");
if (s.performance())
if (settings.performance())
arguments.push_back("--enable=performance");
if (s.portability())
if (settings.portability())
arguments.push_back("--enable=portability");
if (s.information())
if (settings.information())
arguments.push_back("--enable=information");
if (s.unusedFunction())
if (settings.unusedFunction())
arguments.push_back("--enable=unusedFunction");
if (s.missingInclude())
if (settings.missingInclude())
arguments.push_back("--enable=missingInclude");
if (s.inconclusive())
if (settings.inconclusive())
arguments.push_back("--inconclusive");
if (s.forceDefines())
if (settings.forceDefines())
arguments.push_back("--force");
if (!s.unusedFunction() && !s.customArguments().contains("-j "))
if (!settings.unusedFunction() && !settings.customArguments().contains("-j "))
arguments.push_back("-j " + QString::number(QThread::idealThreadCount()));
arguments.push_back("--template=\"{file},{line},{severity},{id},{message}\"");
m_runner->reconfigure(s.binary.effectiveBinary(), arguments.join(' '));
m_runner->reconfigure(settings.binary.effectiveBinary(), arguments.join(' '));
}
QStringList CppcheckTool::additionalArguments(const CppEditor::ProjectPart &part) const

View File

@@ -24,6 +24,7 @@ namespace Cppcheck::Internal {
class CppcheckRunner;
class CppcheckDiagnosticManager;
class CppcheckSettings;
class CppcheckTool final : public QObject
{
@@ -33,7 +34,7 @@ public:
CppcheckTool(CppcheckDiagnosticManager &manager, const Utils::Id &progressId);
~CppcheckTool() override;
void updateOptions();
void updateOptions(const CppcheckSettings &settings);
void setProject(ProjectExplorer::Project *project);
void check(const Utils::FilePaths &files);
void stop(const Utils::FilePaths &files);
@@ -45,7 +46,7 @@ public:
void finishWithFail(const QString &exitMessage);
private:
void updateArguments();
void updateArguments(const CppcheckSettings &settings);
void addToQueue(const Utils::FilePaths &files, const CppEditor::ProjectPart &part);
QStringList additionalArguments(const CppEditor::ProjectPart &part) const;

View File

@@ -237,6 +237,8 @@ void DapClient::emitSignals(const QJsonDocument &doc)
type = DapResponseType::SetBreakpoints;
} else if (command == "setFunctionBreakpoints") {
type = DapResponseType::SetFunctionBreakpoints;
} else if (command == "attach") {
type = DapResponseType::Attach;
}
emit responseReady(type, ob);
return;

View File

@@ -54,6 +54,7 @@ enum class DapResponseType
Evaluate,
SetBreakpoints,
SetFunctionBreakpoints,
Attach,
Unknown
};

View File

@@ -7,7 +7,9 @@
#include <coreplugin/messagemanager.h>
#include <debugger/debuggeractions.h>
#include <debugger/debuggermainwindow.h>
#include <debugger/debuggersourcepathmappingwidget.h>
#include <utils/mimeconstants.h>
#include <utils/mimeutils.h>
@@ -18,6 +20,7 @@
#include <projectexplorer/projecttree.h>
#include <QDebug>
#include <QJsonArray>
#include <QLocalSocket>
#include <QVersionNumber>
@@ -112,15 +115,69 @@ LldbDapEngine::LldbDapEngine()
setDebuggerType("DAP");
}
QJsonArray LldbDapEngine::sourceMap() const
{
QJsonArray sourcePathMapping;
const SourcePathMap sourcePathMap
= mergePlatformQtPath(runParameters(), settings().sourcePathMap());
for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd(); it != cend; ++it) {
sourcePathMapping.append(QJsonArray{
{it.key(), expand(it.value())},
});
}
return sourcePathMapping;
}
QJsonArray LldbDapEngine::preRunCommands() const
{
const QStringList lines = settings().gdbStartupCommands().split('\n')
+ runParameters().additionalStartupCommands.split('\n');
QJsonArray result;
for (const QString &line : lines) {
const QString trimmed = line.trimmed();
if (!trimmed.isEmpty() && !trimmed.startsWith('#'))
result.append(trimmed);
}
return result;
}
void LldbDapEngine::handleDapInitialize()
{
// Documentation at:
// * https://github.com/llvm/llvm-project/tree/main/lldb/tools/lldb-dap#lldb-dap
// * https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/package.json
const DebuggerRunParameters &rp = runParameters();
if (!isLocalAttachEngine()) {
DapEngine::handleDapInitialize();
m_dapClient->postRequest(
"launch",
QJsonObject{
{"noDebug", false},
{"program", rp.inferior.command.executable().path()},
{"args", rp.inferior.command.arguments()},
{"cwd", rp.inferior.workingDirectory.path()},
{"sourceMap", sourceMap()},
{"preRunCommands", preRunCommands()},
{"__restart", ""},
});
qCDebug(logCategory()) << "handleDapLaunch";
return;
}
QTC_ASSERT(state() == EngineRunRequested, qCDebug(logCategory()) << state());
m_dapClient->postRequest("attach", QJsonObject{{"__restart", ""}});
m_dapClient->postRequest(
"attach",
QJsonObject{
{"program", rp.inferior.command.executable().path()},
{"pid", QString::number(rp.attachPID.pid())},
{"sourceMap", sourceMap()},
{"preRunCommands", preRunCommands()},
{"__restart", ""},
});
qCDebug(logCategory()) << "handleDapAttach";
}
@@ -136,7 +193,7 @@ void LldbDapEngine::handleDapConfigurationDone()
return;
}
notifyEngineRunAndInferiorStopOk();
notifyEngineRunAndInferiorRunOk();
}
void LldbDapEngine::setupEngine()
@@ -146,9 +203,6 @@ void LldbDapEngine::setupEngine()
const DebuggerRunParameters &rp = runParameters();
CommandLine cmd{rp.debugger.command.executable()};
if (isLocalAttachEngine())
cmd.addArgs({"--debugger-pid", QString::number(rp.attachPID.pid())});
IDataProvider *dataProvider = new ProcessDataProvider(rp, cmd, this);
m_dapClient = new LldbDapClient(dataProvider, this);

View File

@@ -21,6 +21,9 @@ private:
bool isLocalAttachEngine() const;
bool acceptsBreakpoint(const BreakpointParameters &bp) const override;
const QLoggingCategory &logCategory() override;
QJsonArray sourceMap() const;
QJsonArray preRunCommands() const;
};
} // Debugger::Internal

View File

@@ -100,6 +100,8 @@ enum DebuggerEngineType
GdbEngineType = 0x001,
CdbEngineType = 0x004,
LldbEngineType = 0x100,
GdbDapEngineType = 0x200,
LldbDapEngineType = 0x400,
UvscEngineType = 0x1000
};

View File

@@ -2625,6 +2625,8 @@ bool DebuggerRunParameters::isCppDebugging() const
return cppEngineType == GdbEngineType
|| cppEngineType == LldbEngineType
|| cppEngineType == CdbEngineType
|| cppEngineType == GdbDapEngineType
|| cppEngineType == LldbDapEngineType
|| cppEngineType == UvscEngineType;
}

View File

@@ -271,6 +271,10 @@ QString DebuggerItem::engineTypeName() const
return QLatin1String("CDB");
case LldbEngineType:
return QLatin1String("LLDB");
case GdbDapEngineType:
return QLatin1String("GDB DAP");
case LldbDapEngineType:
return QLatin1String("LLDB DAP");
case UvscEngineType:
return QLatin1String("UVSC");
default:

View File

@@ -494,6 +494,12 @@ void DebuggerRunTool::start()
case LldbEngineType:
m_engines << createLldbEngine();
break;
case GdbDapEngineType:
m_engines << createDapEngine(ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE);
break;
case LldbDapEngineType:
m_engines << createDapEngine(ProjectExplorer::Constants::DAP_LLDB_DEBUG_RUN_MODE);
break;
case UvscEngineType:
m_engines << createUvscEngine();
break;

View File

@@ -848,6 +848,16 @@ void IosSimulatorToolHandlerPrivate::installAppOnSimulator()
futureSynchronizer.addFuture(Utils::onResultReady(installFuture, q, onResponseAppInstall));
}
#ifdef Q_OS_UNIX
static void monitorPid(QPromise<void> &promise, qint64 pid)
{
do {
// Poll every 1 sec to check whether the app is running.
QThread::msleep(1000);
} while (!promise.isCanceled() && kill(pid, 0) == 0);
}
#endif
void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &extraArgs)
{
const QString bundleId = SimulatorControl::bundleIdentifier(m_bundlePath);
@@ -871,21 +881,7 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
"Install Xcode 8 or later.").arg(bundleId));
}
auto monitorPid = [this](QPromise<void> &promise, qint64 pid) {
#ifdef Q_OS_UNIX
do {
// Poll every 1 sec to check whether the app is running.
QThread::msleep(1000);
} while (!promise.isCanceled() && kill(pid, 0) == 0);
#else
Q_UNUSED(pid)
#endif
// Future is cancelled if the app is stopped from the qt creator.
if (!promise.isCanceled())
stop(0);
};
auto onResponseAppLaunch = [this, captureConsole, monitorPid, stdoutFile, stderrFile](
auto onResponseAppLaunch = [this, captureConsole, stdoutFile, stderrFile](
const SimulatorControl::Response &response) {
if (response) {
if (!isResponseValid(*response))
@@ -893,8 +889,15 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
m_pid = response->inferiorPid;
gotInferiorPid(m_bundlePath, m_deviceId, response->inferiorPid);
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Success);
#ifdef Q_OS_UNIX
// Start monitoring app's life signs.
futureSynchronizer.addFuture(Utils::asyncRun(monitorPid, response->inferiorPid));
futureSynchronizer.addFuture(Utils::onFinished(
Utils::asyncRun(monitorPid, response->inferiorPid), q,
[this](const QFuture<void> &future) {
if (!future.isCanceled())
stop(0);
}));
#endif
if (captureConsole)
futureSynchronizer.addFuture(Utils::asyncRun(&LogTailFiles::exec, &outputLogger,
stdoutFile, stderrFile));

View File

@@ -55,7 +55,7 @@ FileContainer AllProjectsFind::filesForProjects(const QStringList &nameFilters,
const QStringList &exclusionFilters,
const QList<Project *> &projects)
{
std::function<FilePaths(const FilePaths &)> filterFiles
const FilterFilesFunction filterFiles
= Utils::filterFilesFunction(nameFilters, exclusionFilters);
const QMap<FilePath, QTextCodec *> openEditorEncodings
= TextDocument::openedTextDocumentEncodings();

View File

@@ -30,7 +30,8 @@ enum {
ItemUpdatedFromBelowRole, // A subitem got updated, re-expansion is necessary.
ActiveItemRole, // The index of the currently selected item in the tree view
KitIdRole, // The kit id in case the item is associated with a kit.
PanelWidgetRole // This item's widget to be shown as central widget.
PanelWidgetRole, // This item's widget to be shown as central widget.
IsShowMoreRole // This item is a "show more" item.
};
class ProjectWindowPrivate;

View File

@@ -170,6 +170,7 @@ public:
void ensureWidget();
void rebuildContents();
void ensureShowMoreItem();
void setShowAllKits(bool showAllKits)
{
@@ -206,6 +207,10 @@ public:
if (role == Qt::DisplayRole) {
return !m_p->showAllKits() ? Tr::tr("Show All Kits") : Tr::tr("Hide Inactive Kits");
}
if (role == IsShowMoreRole)
return true;
return {};
}
@@ -814,6 +819,14 @@ void TargetItem::updateSubItems()
}
}
void TargetGroupItemPrivate::ensureShowMoreItem()
{
if (q->findAnyChild([](TreeItem *item) { return item->data(0, IsShowMoreRole).toBool(); }))
return;
q->appendChild(new ShowMoreItem(this));
}
void TargetGroupItemPrivate::rebuildContents()
{
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
@@ -829,7 +842,7 @@ void TargetGroupItemPrivate::rebuildContents()
}
if (isAnyKitNotEnabled)
q->appendChild(new ShowMoreItem(this));
ensureShowMoreItem();
if (q->parent()) {
q->parent()
@@ -843,6 +856,7 @@ void TargetGroupItemPrivate::handleTargetAdded(Target *target)
{
if (TargetItem *item = q->targetItem(target))
item->updateSubItems();
ensureShowMoreItem();
q->update();
}
@@ -850,6 +864,7 @@ void TargetGroupItemPrivate::handleTargetRemoved(Target *target)
{
if (TargetItem *item = q->targetItem(target))
item->updateSubItems();
ensureShowMoreItem();
q->parent()->setData(0, QVariant::fromValue(static_cast<TreeItem *>(q)),
ItemDeactivatedFromBelowRole);
}
@@ -858,6 +873,7 @@ void TargetGroupItemPrivate::handleTargetChanged(Target *target)
{
if (TargetItem *item = q->targetItem(target))
item->updateSubItems();
ensureShowMoreItem();
q->setData(0, QVariant(), ItemActivatedFromBelowRole);
}

View File

@@ -149,7 +149,7 @@ IAssistProposal *MergedCompletionAssistProcessor::perform()
});
m_qbsProcessor->start(std::make_unique<AssistInterface>(m_interface->cursor(),
m_interface->filePath(),
ExplicitlyInvoked));
m_interface->reason()));
} else {
m_qbsProposal = nullptr;
}
@@ -162,7 +162,7 @@ IAssistProposal *MergedCompletionAssistProcessor::perform()
return m_qmlProcessor->start(
std::make_unique<QmlJSCompletionAssistInterface>(qmlJsIface->cursor(),
qmlJsIface->filePath(),
ExplicitlyInvoked,
m_interface->reason(),
qmlJsIface->semanticInfo()));
}

View File

@@ -27,7 +27,7 @@ void BakeLightsConnectionManager::setFinishedCallback(Callback callback)
void BakeLightsConnectionManager::dispatchCommand(const QVariant &command,
ConnectionManagerInterface::Connection &)
{
static const int commandType = QMetaType::type("PuppetToCreatorCommand");
static const int commandType = QMetaType::fromName("PuppetToCreatorCommand").id();
if (command.typeId() == commandType) {
auto cmd = command.value<PuppetToCreatorCommand>();

View File

@@ -45,7 +45,7 @@ bool ImageCacheConnectionManager::waitForCapturedData()
void ImageCacheConnectionManager::dispatchCommand(const QVariant &command,
ConnectionManagerInterface::Connection &)
{
static const int capturedDataCommandType = QMetaType::type("CapturedDataCommand");
static const int capturedDataCommandType = QMetaType::fromName("CapturedDataCommand").id();
if (command.typeId() == capturedDataCommandType) {
m_captureCallback(command.value<CapturedDataCommand>().image);

View File

@@ -107,8 +107,8 @@ void BaseConnectionManager::readDataStream(Connection &connection)
connection.blockSize = 0;
#ifdef NANOTRACE_DESIGNSTUDIO_ENABLED
if (command.typeId() != QMetaType::type("PuppetAliveCommand")) {
if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) {
if (command.typeId() != QMetaType::fromName("PuppetAliveCommand").id()) {
if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) {
SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>();
NANOTRACE_INSTANT_ARGS("Sync", "readCommand",
{"name", cmd.name().toStdString()},

View File

@@ -68,7 +68,7 @@ void InteractiveConnectionManager::showCannotConnectToPuppetWarningAndSwitchToEd
void InteractiveConnectionManager::dispatchCommand(const QVariant &command, Connection &connection)
{
static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand");
static const int puppetAliveCommandType = QMetaType::fromName("PuppetAliveCommand").id();
if (command.typeId() == puppetAliveCommandType) {
puppetAlive(connection);

View File

@@ -93,18 +93,18 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
{
NANOTRACE_SCOPE_ARGS("Update", "dispatchCommand", {"name", command.typeName()});
static const int informationChangedCommandType = QMetaType::type("InformationChangedCommand");
static const int valuesChangedCommandType = QMetaType::type("ValuesChangedCommand");
static const int valuesModifiedCommandType = QMetaType::type("ValuesModifiedCommand");
static const int pixmapChangedCommandType = QMetaType::type("PixmapChangedCommand");
static const int childrenChangedCommandType = QMetaType::type("ChildrenChangedCommand");
static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand");
static const int componentCompletedCommandType = QMetaType::type("ComponentCompletedCommand");
static const int tokenCommandType = QMetaType::type("TokenCommand");
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
static const int puppetToCreatorCommandType = QMetaType::type("PuppetToCreatorCommand");
static const int SyncNanotraceCommandType = QMetaType::type("SyncNanotraceCommand");
static const int informationChangedCommandType = QMetaType::fromName("InformationChangedCommand").id();
static const int valuesChangedCommandType = QMetaType::fromName("ValuesChangedCommand").id();
static const int valuesModifiedCommandType = QMetaType::fromName("ValuesModifiedCommand").id();
static const int pixmapChangedCommandType = QMetaType::fromName("PixmapChangedCommand").id();
static const int childrenChangedCommandType = QMetaType::fromName("ChildrenChangedCommand").id();
static const int statePreviewImageChangedCommandType = QMetaType::fromName("StatePreviewImageChangedCommand").id();
static const int componentCompletedCommandType = QMetaType::fromName("ComponentCompletedCommand").id();
static const int tokenCommandType = QMetaType::fromName("TokenCommand").id();
static const int debugOutputCommandType = QMetaType::fromName("DebugOutputCommand").id();
static const int changeSelectionCommandType = QMetaType::fromName("ChangeSelectionCommand").id();
static const int puppetToCreatorCommandType = QMetaType::fromName("PuppetToCreatorCommand").id();
static const int SyncNanotraceCommandType = QMetaType::fromName("SyncNanotraceCommand").id();
qCInfo(instanceViewBenchmark) << "dispatching command" << command.typeId() << command.typeName();
if (command.typeId() == informationChangedCommandType) {
@@ -173,7 +173,7 @@ QString NodeInstanceServerProxy::qrcMappingString() const
void NodeInstanceServerProxy::writeCommand(const QVariant &command)
{
#ifdef NANOTRACE_DESIGNSTUDIO_ENABLED
if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) {
if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) {
SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>();
NANOTRACE_INSTANT_ARGS("Sync", "writeCommand",
{"name", cmd.name().toStdString()},

View File

@@ -201,7 +201,7 @@ QVariant read(const QString &typeStr, const QString &str, const MetaInfo &)
QVariant read(const QString &typeStr, const QString &str)
{
int type = QMetaType::fromName(typeStr.toUtf8().constData()).id();
int type = QMetaType::fromName(typeStr.toUtf8()).id();
if (type == 0) {
if (typeStr != "binding"_L1 && typeStr != "enum"_L1) {
qWarning() << "Type " << typeStr
@@ -266,7 +266,7 @@ QVariant read(int variantType, const QString &str)
value = vector3DFromString(str, &conversionOk);
break;
default: {
if (variantType == QMetaType::type("Enumeration")) {
if (variantType == QMetaType::fromName("Enumeration").id()) {
value = QVariant::fromValue<Enumeration>(enumerationFromString(str, &conversionOk));
} else {
value = QVariant(str);

View File

@@ -242,23 +242,23 @@ bool isLiteralValue(AST::UiScriptBinding *script)
int propertyType(const QString &typeName)
{
if (typeName == u"bool")
return QMetaType::type("bool");
return QMetaType::fromName("bool").id();
else if (typeName == u"color")
return QMetaType::type("QColor");
return QMetaType::fromName("QColor").id();
else if (typeName == u"date")
return QMetaType::type("QDate");
return QMetaType::fromName("QDate").id();
else if (typeName == u"int")
return QMetaType::type("int");
return QMetaType::fromName("int").id();
else if (typeName == u"real")
return QMetaType::type("double");
return QMetaType::fromName("double").id();
else if (typeName == u"double")
return QMetaType::type("double");
return QMetaType::fromName("double").id();
else if (typeName == u"string")
return QMetaType::type("QString");
return QMetaType::fromName("QString").id();
else if (typeName == u"url")
return QMetaType::type("QUrl");
return QMetaType::fromName("QUrl").id();
else if (typeName == u"var" || typeName == u"variant")
return QMetaType::type("QVariant");
return QMetaType::fromName("QVariant").id();
else
return -1;
}
@@ -272,7 +272,7 @@ QVariant convertDynamicPropertyValueToVariant(const QString &astValue,
return QString();
const int type = propertyType(astType);
if (type == QMetaType::type("QVariant")) {
if (type == QMetaType::fromName("QVariant").id()) {
if (cleanedValue.isNull()) // Explicitly isNull, NOT isEmpty!
return QVariant(static_cast<QVariant::Type>(type));
else

View File

@@ -391,8 +391,8 @@ void NodeInstanceClientProxy::readDataStream()
QVariant command = readCommandFromIOStream(m_inputIoDevice, &readCommandCounter, &blockSize);
#ifdef NANOTRACE_DESIGNSTUDIO_ENABLED
if (command.typeId() != QMetaType::type("EndNanotraceCommand")) {
if (command.typeId() == QMetaType::type("SyncNanotraceCommand")) {
if (command.typeId() != QMetaType::fromName("EndNanotraceCommand").id()) {
if (command.typeId() == QMetaType::fromName("SyncNanotraceCommand").id()) {
SyncNanotraceCommand cmd = command.value<SyncNanotraceCommand>();
NANOTRACE_INSTANT_ARGS("Sync", "readCommand",
{"name", cmd.name().toStdString()},

View File

@@ -38,7 +38,7 @@ void TestConnectionManager::writeCommand(const QVariant &command)
void TestConnectionManager::dispatchCommand(const QVariant &command, Connection &connection)
{
static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand");
static const int synchronizeCommandType = QMetaType::fromName("SynchronizeCommand").id();
if (command.typeId() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();