Merge remote-tracking branch 'origin/5.0'

Change-Id: I368fffe959c10f5942ccb1bcdb1fed4ac1a7460b
This commit is contained in:
Eike Ziller
2021-07-08 11:16:06 +02:00
61 changed files with 205 additions and 75 deletions

View File

@@ -48,6 +48,7 @@ else()
if(dcIndex GREATER_EQUAL 0) if(dcIndex GREATER_EQUAL 0)
find_package(Qt6${possible_private_libs}Private CONFIG QUIET) find_package(Qt6${possible_private_libs}Private CONFIG QUIET)
if(TARGET Qt6::${possible_private_libs}Private) if(TARGET Qt6::${possible_private_libs}Private)
set_property(TARGET Qt6::${possible_private_libs}Private PROPERTY IMPORTED_GLOBAL TRUE)
add_library(Qt5::${possible_private_libs} ALIAS Qt6::${possible_private_libs}Private) add_library(Qt5::${possible_private_libs} ALIAS Qt6::${possible_private_libs}Private)
list(REMOVE_AT Qt5_FIND_COMPONENTS ${dcIndex}) list(REMOVE_AT Qt5_FIND_COMPONENTS ${dcIndex})
endif() endif()

36
dist/changes-5.0.0.md vendored
View File

@@ -21,17 +21,20 @@ Editing
* Added line ending and indentation to file properties information * Added line ending and indentation to file properties information
* Added menu item and shortcut for editing bookmark comments * Added menu item and shortcut for editing bookmark comments
(QTCREATORBUG-25696) (QTCREATORBUG-25696)
* Fixed folding for Markdown (QTCREATORBUG-25882)
### C++ ### C++
* Added experimental support for `clangd` (no code completion yet, requires
development build of `clangd`)
* Added highlighting option for function parameters (QTCREATORBUG-24880) * Added highlighting option for function parameters (QTCREATORBUG-24880)
* Added experimental support for `clangd` for global index (`Find References`,
`Rename Symbol`, `Follow Symbol`)
* Added template parameters to symbols in Locator * Added template parameters to symbols in Locator
* Fixed that project-unrelated files were selected by default when renaming * Fixed that project-unrelated files were selected by default when renaming
symbols (QTCREATORBUG-8561) symbols (QTCREATORBUG-8561)
* Fixed highlighting of string literals with multi-byte characters * Fixed highlighting of string literals with multi-byte characters
(QTCREATORBUG-25715) (QTCREATORBUG-25715)
* Fixed code model for changed but not yet built `.ui` and `.scxml` files
(QTCREATORBUG-25937)
### QML ### QML
@@ -57,10 +60,17 @@ Editing
Projects Projects
-------- --------
* Added experimental support for building and running on Docker devices
* Added option `Show Source and Header Groups` to project tree
(QTCREATORBUG-25313)
* Fixed crash when closing project while changing current configuration * Fixed crash when closing project while changing current configuration
(QTCREATORBUG-25655) (QTCREATORBUG-25655)
* Fixed that output of custom targets was interpreted as errors * Fixed that output of custom targets was interpreted as errors
(QTCREATORBUG-25677) (QTCREATORBUG-25677)
* Fixed missing update of run configuration environment (QTCREATORBUG-25947)
* Fixed that user files were unnecessarily saved with new time stamp
(QTCREATORBUG-25921)
* Reduced UI freeze after loading projects (QTCREATORBUG-25783)
### CMake ### CMake
@@ -69,6 +79,12 @@ Projects
* Added CMake output to right side of `Projects` mode (QTCREATORBUG-25522) * Added CMake output to right side of `Projects` mode (QTCREATORBUG-25522)
* Fixed `Jump to File` for file names with special characters * Fixed `Jump to File` for file names with special characters
(QTCREATORBUG-25572) (QTCREATORBUG-25572)
* Fixed updating of available targets (QTCREATORBUG-24914, QTCREATORBUG-25906)
* Fixed persistence of CMake tool options (QTCREATORBUG-25911)
### Qbs
* Improved performance of registering profiles (QTCREATORBUG-25463)
Debugging Debugging
--------- ---------
@@ -87,6 +103,14 @@ Debugging
* Implemented `Load QML Stack` for LLDB (QTCREATORBUG-25554) * Implemented `Load QML Stack` for LLDB (QTCREATORBUG-25554)
Analyzer
--------
### Clang
* Fixed URL for `clang-tidy` checks (QTCREATORBUG-25902)
* Fixed application of options to checks (QTCREATORBUG-25827)
FakeVim FakeVim
------- -------
@@ -103,6 +127,11 @@ Platforms
* Fixed performance issue with registering file watches after loading projects * Fixed performance issue with registering file watches after loading projects
### Android
* Fixed detection of `_prepare_apk_dir` target for CMake projects
(QTCREATORBUG-25216)
### QNX ### QNX
* Fixed device configuration * Fixed device configuration
@@ -138,6 +167,7 @@ Jaroslaw Kobus
Jochen Becher Jochen Becher
Johanna Vanhatapio Johanna Vanhatapio
Kai Köhne Kai Köhne
Kama Wójcik
Knud Dollereder Knud Dollereder
Leena Miettinen Leena Miettinen
Lukas Holecek Lukas Holecek
@@ -149,6 +179,7 @@ Michael Weghorn
Miikka Heikkinen Miikka Heikkinen
Miina Puuronen Miina Puuronen
Miklós Márton Miklós Márton
Nodir Temirkhodjaev
Oliver Wolff Oliver Wolff
Orgad Shaneh Orgad Shaneh
Pekka Kaikkonen Pekka Kaikkonen
@@ -158,4 +189,5 @@ Tim Blechmann
Tim Jenssen Tim Jenssen
Tom Praschan Tom Praschan
Vikas Pachdha Vikas Pachdha
Wojciech Smigaj
Youri Westerman Youri Westerman

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

@@ -162,6 +162,10 @@
editor, select \uicontrol GDB > \uicontrol {Adjust breakpoint locations} editor, select \uicontrol GDB > \uicontrol {Adjust breakpoint locations}
or \uicontrol CDB > \uicontrol {Correct breakpoint location}. or \uicontrol CDB > \uicontrol {Correct breakpoint location}.
When using GDB as backend, you can extend the ordinary GDB
breakpoint class by using Python. Select \uicontrol GDB >
\uicontrol {Use pseudo message tracepoints}.
When using CDB as backend, you can specify that the debugger should break on When using CDB as backend, you can specify that the debugger should break on
specific events, such as C++ exceptions, thread creation or exit, loading or specific events, such as C++ exceptions, thread creation or exit, loading or
unloading \l{Viewing Modules}{application modules}, or particular output. unloading \l{Viewing Modules}{application modules}, or particular output.

View File

@@ -112,6 +112,10 @@
By default, GDB shows AT&T style disassembly. To switch to the Intel style, By default, GDB shows AT&T style disassembly. To switch to the Intel style,
select the \uicontrol {Use Intel style disassembly} check box. select the \uicontrol {Use Intel style disassembly} check box.
To have GDB automatically save a copy of its symbol index in a cache
on disk and retrieve it from there when loading the same binary in the
future, select the \uicontrol {Use automatic symbol cache} check box.
To execute GDB commands after GDB has been started, but before the debugged To execute GDB commands after GDB has been started, but before the debugged
program is started or attached, and before the debugging helpers are program is started or attached, and before the debugging helpers are
initialized, enter them in the \uicontrol {Additional Startup Commands} initialized, enter them in the \uicontrol {Additional Startup Commands}

View File

@@ -1540,8 +1540,16 @@
\section1 Built-in Debugger Is Slow During Startup and Runtime \section1 Built-in Debugger Is Slow During Startup and Runtime
The part of the slowness that is related to the loading of debug information Slowness that is related to the loading of debug information is hard to
is hard to avoid. Another part stems from maintaining breakpoints inside avoid.
When using GDB as backend, you can automatically save a copy of
its symbol index in a cache on disk and retrieve it from there
when loading the same binary in the future. Select \uicontrol Tools
> \uicontrol Options > \uicontrol Debugger > \uicontrol GDB >
\uicontrol {Use automatic symbol cache}.
Some slowness stems from maintaining breakpoints inside
the debugger (under some circumstances all breakpoints need to be inserted the debugger (under some circumstances all breakpoints need to be inserted
and removed again for each step) and the evaluation of expressions after and removed again for each step) and the evaluation of expressions after
each step. We recommend that you minimize the number of breakpoints and each step. We recommend that you minimize the number of breakpoints and

View File

@@ -171,6 +171,9 @@
the kit's toolkits and SDKs, and keeps them synchronized when selecting the kit's toolkits and SDKs, and keeps them synchronized when selecting
\uicontrol Apply or \uicontrol OK. \uicontrol Apply or \uicontrol OK.
The \uicontrol {MCU dependencies} field displays paths to 3rd party
software required for MCU development with the current kit.
\section1 Running Applications on MCUs \section1 Running Applications on MCUs
You can use a wizard to set up a project for developing an application that You can use a wizard to set up a project for developing an application that

View File

@@ -133,6 +133,9 @@
not enabled for the current target, not enabled for the current target,
\li \uicontrol {Hide Empty Directories} hides directories that do not \li \uicontrol {Hide Empty Directories} hides directories that do not
contain any files. contain any files.
\li \uicontrol {Show Source and Header Groups} shows source and header
files grouped together in the view, regardless of their location in
the file system.
\endlist \endlist
To stop synchronizing the position in the project tree with the file To stop synchronizing the position in the project tree with the file

View File

@@ -71,9 +71,7 @@ public:
PropertyNameList propertyNameListForWritableProperties(QObject *object, PropertyNameList propertyNameListForWritableProperties(QObject *object,
const PropertyName &baseName = PropertyName(), const PropertyName &baseName = PropertyName(),
QObjectList *inspectedObjects = nullptr); QObjectList *inspectedObjects = nullptr);
PropertyNameList allPropertyNames(QObject *object, PropertyNameList allPropertyNames(QObject *object);
const PropertyName &baseName = PropertyName(),
QObjectList *inspectedObjects = nullptr);
bool hasFullImplementedListInterface(const QQmlListReference &list); bool hasFullImplementedListInterface(const QQmlListReference &list);
void registerCustomData(QObject *object); void registerCustomData(QObject *object);

View File

@@ -68,8 +68,8 @@ static void addToPropertyNameListIfNotBlackListed(
} }
PropertyNameList allPropertyNamesInline(QObject *object, PropertyNameList allPropertyNamesInline(QObject *object,
const PropertyName &baseName, const PropertyName &baseName = {},
QObjectList *inspectedObjects, QObjectList *inspectedObjects = nullptr,
int depth = 0) int depth = 0)
{ {
QQuickDesignerSupport::PropertyNameList propertyNameList; QQuickDesignerSupport::PropertyNameList propertyNameList;
@@ -136,24 +136,20 @@ PropertyNameList allPropertyNamesInline(QObject *object,
} }
#endif #endif
PropertyNameList allPropertyNames(QObject *object, PropertyNameList allPropertyNames(QObject *object)
const PropertyName &baseName,
QObjectList *inspectedObjects)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QQuickDesignerSupportProperties::allPropertyNames(object, baseName, inspectedObjects); return QQuickDesignerSupportProperties::allPropertyNames(object);
#elif QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) #elif QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
return allPropertyNamesInline(object, baseName, inspectedObjects); return allPropertyNamesInline(object);
#else #else
return QQuickDesignerSupportProperties::allPropertyNames(object, baseName, inspectedObjects); return QQuickDesignerSupportProperties::allPropertyNames(object);
#endif #endif
} }
PropertyNameList propertyNameListForWritableProperties(QObject *object, PropertyNameList propertyNameListForWritableProperties(QObject *object)
const PropertyName &baseName,
QObjectList *inspectedObjects)
{ {
return QQuickDesignerSupportProperties::propertyNameListForWritableProperties(object, baseName, inspectedObjects); return QQuickDesignerSupportProperties::propertyNameListForWritableProperties(object);
} }
void tweakObjects(QObject *object) void tweakObjects(QObject *object)

View File

@@ -92,7 +92,7 @@ struct ResponseHandler
using ResponseHandlers = std::function<void(const MessageId &, const QByteArray &, QTextCodec *)>; using ResponseHandlers = std::function<void(const MessageId &, const QByteArray &, QTextCodec *)>;
using MethodHandler = std::function<void(const QString &, const MessageId &, const IContent *)>; using MethodHandler = std::function<void(const QString &, const MessageId &, const IContent *)>;
inline uint qHash(const LanguageServerProtocol::MessageId &id) inline auto qHash(const LanguageServerProtocol::MessageId &id)
{ {
if (Utils::holds_alternative<int>(id)) if (Utils::holds_alternative<int>(id))
return QT_PREPEND_NAMESPACE(qHash(Utils::get<int>(id))); return QT_PREPEND_NAMESPACE(qHash(Utils::get<int>(id)));

View File

@@ -55,7 +55,7 @@ private:
QUuid m_uuid; QUuid m_uuid;
}; };
inline uint qHash(const Uid &uid) inline auto qHash(const Uid &uid)
{ {
return qHash(uid.get()); return qHash(uid.get());
} }

View File

@@ -151,15 +151,15 @@ private:
QColor m_color; QColor m_color;
}; };
inline uint qHash(CustomRelation::Relationship relationship) { inline auto qHash(CustomRelation::Relationship relationship) {
return ::qHash(static_cast<int>(relationship)); return ::qHash(static_cast<int>(relationship));
} }
inline uint qHash(CustomRelation::ShaftPattern pattern) { inline auto qHash(CustomRelation::ShaftPattern pattern) {
return ::qHash(static_cast<int>(pattern)); return ::qHash(static_cast<int>(pattern));
} }
inline uint qHash(CustomRelation::Head head) { inline auto qHash(CustomRelation::Head head) {
return ::qHash(static_cast<int>(head)); return ::qHash(static_cast<int>(head));
} }

View File

@@ -77,7 +77,7 @@ bool operator==(const IconKey &lhs, const IconKey &rhs) {
&& lhs.m_lineWidth == rhs.m_lineWidth; && lhs.m_lineWidth == rhs.m_lineWidth;
} }
uint qHash(const IconKey &key) { auto qHash(const IconKey &key) {
return ::qHash(key.m_element) + qHash(key.m_stereotypes) + qHash(key.m_defaultIconPath) return ::qHash(key.m_element) + qHash(key.m_stereotypes) + qHash(key.m_defaultIconPath)
+ qHash(key.m_styleUid) + ::qHash(key.m_size.width()) + ::qHash(key.m_size.height()); + qHash(key.m_styleUid) + ::qHash(key.m_size.width()) + ::qHash(key.m_size.height());
} }

View File

@@ -302,7 +302,7 @@ public:
return datastream; return datastream;
} }
friend uint qHash(const Utf8String &utf8String) friend auto qHash(const Utf8String &utf8String)
{ {
return qHash(utf8String.byteArray); return qHash(utf8String.byteArray);
} }

View File

@@ -1378,15 +1378,25 @@ FilePath FilePath::onDevice(const FilePath &deviceTemplate) const
assert(fullPath == FilePath::fromUrl("docker://123/usr/bin/make")) assert(fullPath == FilePath::fromUrl("docker://123/usr/bin/make"))
\endcode \endcode
*/ */
FilePath FilePath::onDeviceSearchInPath() const FilePath FilePath::onDeviceSearchInPath(const FilePaths &additionalDirs) const
{ {
if (needsDevice()) { if (needsDevice()) {
QTC_ASSERT(s_deviceHooks.searchInPath, return {}); QTC_ASSERT(s_deviceHooks.searchInPath, return {});
return s_deviceHooks.searchInPath(*this); return s_deviceHooks.searchInPath(*this, additionalDirs);
} }
return Environment::systemEnvironment().searchInPath(path()); return Environment::systemEnvironment().searchInPath(path(), additionalDirs);
} }
Environment FilePath::deviceEnvironment() const
{
if (needsDevice()) {
QTC_ASSERT(s_deviceHooks.environment, return {});
return s_deviceHooks.environment(*this);
}
return Environment::systemEnvironment();
}
FilePath FilePath::pathAppended(const QString &path) const FilePath FilePath::pathAppended(const QString &path) const
{ {
FilePath fn = *this; FilePath fn = *this;

View File

@@ -40,7 +40,10 @@
#include <functional> #include <functional>
#include <memory> #include <memory>
namespace Utils { class FilePath; } namespace Utils {
class Environment;
class FilePath;
} // Utils
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QDataStream; class QDataStream;
@@ -82,7 +85,7 @@ public:
std::function<bool(const FilePath &)> removeRecursively; std::function<bool(const FilePath &)> removeRecursively;
std::function<bool(const FilePath &, const FilePath &)> copyFile; std::function<bool(const FilePath &, const FilePath &)> copyFile;
std::function<bool(const FilePath &, const FilePath &)> renameFile; std::function<bool(const FilePath &, const FilePath &)> renameFile;
std::function<FilePath(const FilePath &)> searchInPath; std::function<FilePath(const FilePath &, const QList<FilePath> &)> searchInPath;
std::function<FilePath(const FilePath &)> symLinkTarget; std::function<FilePath(const FilePath &)> symLinkTarget;
std::function<QList<FilePath>(const FilePath &, const QStringList &, std::function<QList<FilePath>(const FilePath &, const QStringList &,
QDir::Filters, QDir::SortFlags)> dirEntries; QDir::Filters, QDir::SortFlags)> dirEntries;
@@ -91,6 +94,7 @@ public:
std::function<QDateTime(const FilePath &)> lastModified; std::function<QDateTime(const FilePath &)> lastModified;
std::function<QFile::Permissions(const FilePath &)> permissions; std::function<QFile::Permissions(const FilePath &)> permissions;
std::function<OsType(const FilePath &)> osType; std::function<OsType(const FilePath &)> osType;
std::function<Environment(const FilePath &)> environment;
}; };
class QTCREATOR_UTILS_EXPORT FilePath class QTCREATOR_UTILS_EXPORT FilePath
@@ -212,7 +216,8 @@ public:
static void setDeviceFileHooks(const DeviceFileHooks &hooks); static void setDeviceFileHooks(const DeviceFileHooks &hooks);
FilePath onDeviceSearchInPath() const; FilePath onDeviceSearchInPath(const QList<FilePath> &additionalDirs = {}) const;
Environment deviceEnvironment() const;
private: private:
friend class ::tst_fileutils; friend class ::tst_fileutils;

View File

@@ -120,7 +120,7 @@ protected:
QExplicitlySharedDataPointer<Internal::MimeTypePrivate> d; QExplicitlySharedDataPointer<Internal::MimeTypePrivate> d;
}; };
inline uint qHash(const MimeType &mime) { return qHash(mime.name()); } inline auto qHash(const MimeType &mime) { return qHash(mime.name()); }
} // Utils } // Utils

View File

@@ -155,7 +155,7 @@ namespace std {
template<> struct hash<Utils::SmallString> template<> struct hash<Utils::SmallString>
{ {
using argument_type = Utils::SmallString; using argument_type = Utils::SmallString;
using result_type = uint; using result_type = std::size_t;
result_type operator()(const argument_type& string) const result_type operator()(const argument_type& string) const
{ {
return qHashBits(string.data(), string.size()); return qHashBits(string.data(), string.size());

View File

@@ -37,6 +37,7 @@ namespace Autotest {
using LookupInfo = QPair<QString, QString>; using LookupInfo = QPair<QString, QString>;
static QHash<LookupInfo, bool> s_pchLookupCache; static QHash<LookupInfo, bool> s_pchLookupCache;
Q_GLOBAL_STATIC(QMutex, s_cacheMutex);
CppParser::CppParser(ITestFramework *framework) CppParser::CppParser(ITestFramework *framework)
: ITestParser(framework) : ITestParser(framework)
@@ -96,6 +97,7 @@ bool precompiledHeaderContains(const CPlusPlus::Snapshot &snapshot,
} }
return it.value(); return it.value();
}; };
QMutexLocker l(s_cacheMutex());
return Utils::anyOf(precompiledHeaders, headerContains); return Utils::anyOf(precompiledHeaders, headerContains);
} }
@@ -127,6 +129,7 @@ void CppParser::release()
{ {
m_cppSnapshot = CPlusPlus::Snapshot(); m_cppSnapshot = CPlusPlus::Snapshot();
m_workingCopy = CppTools::WorkingCopy(); m_workingCopy = CppTools::WorkingCopy();
QMutexLocker l(s_cacheMutex());
s_pchLookupCache.clear(); s_pchLookupCache.clear();
} }

View File

@@ -75,7 +75,7 @@ enum class ResultType {
LAST_TYPE = Invalid LAST_TYPE = Invalid
}; };
inline uint qHash(const ResultType &result) inline auto qHash(const ResultType &result)
{ {
return QT_PREPEND_NAMESPACE(qHash(int(result))); return QT_PREPEND_NAMESPACE(qHash(int(result)));
} }

View File

@@ -30,6 +30,7 @@
#include "debugserverproviderchooser.h" #include "debugserverproviderchooser.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <QFormLayout> #include <QFormLayout>

View File

@@ -29,6 +29,8 @@
#include "baremetaldeviceconfigurationwizard.h" #include "baremetaldeviceconfigurationwizard.h"
#include "baremetaldeviceconfigurationwizardpages.h" #include "baremetaldeviceconfigurationwizardpages.h"
#include <utils/fileutils.h>
namespace BareMetal { namespace BareMetal {
namespace Internal { namespace Internal {

View File

@@ -30,6 +30,7 @@
#include "debugserverproviderchooser.h" #include "debugserverproviderchooser.h"
#include <utils/variablechooser.h> #include <utils/variablechooser.h>
#include <utils/fileutils.h>
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <QFormLayout> #include <QFormLayout>

View File

@@ -46,7 +46,7 @@ public:
inline const QString &name() const { return m_name; } inline const QString &name() const { return m_name; }
inline const QString &type() const { return m_type; } inline const QString &type() const { return m_type; }
inline int iconType() const { return m_iconType; } inline int iconType() const { return m_iconType; }
inline uint hash() const { return m_hash; } inline auto hash() const { return m_hash; }
inline bool operator==(const SymbolInformation &other) const inline bool operator==(const SymbolInformation &other) const
{ {
return hash() == other.hash() && iconType() == other.iconType() && name() == other.name() return hash() == other.hash() && iconType() == other.iconType() && name() == other.name()
@@ -64,7 +64,7 @@ private:
}; };
//! qHash overload for QHash/QSet //! qHash overload for QHash/QSet
inline uint qHash(const SymbolInformation &information) inline auto qHash(const SymbolInformation &information)
{ {
return information.hash(); return information.hash();
} }

View File

@@ -55,7 +55,7 @@ public:
}; };
inline uint qHash(SearchResultColor::Style style) inline auto qHash(SearchResultColor::Style style)
{ {
return QT_PREPEND_NAMESPACE(qHash(int(style))); return QT_PREPEND_NAMESPACE(qHash(int(style)));
} }

View File

@@ -49,6 +49,7 @@
#include <cpptools/cppcanonicalsymbol.h> #include <cpptools/cppcanonicalsymbol.h>
#include <cpptools/cppchecksymbols.h> #include <cpptools/cppchecksymbols.h>
#include <cpptools/cppcodeformatter.h> #include <cpptools/cppcodeformatter.h>
#include <cpptools/cppcodemodelsettings.h>
#include <cpptools/cppcompletionassistprovider.h> #include <cpptools/cppcompletionassistprovider.h>
#include <cpptools/cppeditoroutline.h> #include <cpptools/cppeditoroutline.h>
#include <cpptools/cppmodelmanager.h> #include <cpptools/cppmodelmanager.h>
@@ -114,11 +115,15 @@ class CppEditorWidgetPrivate
public: public:
CppEditorWidgetPrivate(CppEditorWidget *q); CppEditorWidgetPrivate(CppEditorWidget *q);
bool shouldOfferOutline() const { return CppModelManager::supportsOutline(m_cppEditorDocument); }
public: public:
QPointer<CppModelManager> m_modelManager; QPointer<CppModelManager> m_modelManager;
CppEditorDocument *m_cppEditorDocument; CppEditorDocument *m_cppEditorDocument;
CppEditorOutline *m_cppEditorOutline = nullptr; CppEditorOutline *m_cppEditorOutline = nullptr;
QAction *m_outlineAction = nullptr;
QTimer m_outlineTimer;
QTimer m_updateFunctionDeclDefLinkTimer; QTimer m_updateFunctionDeclDefLinkTimer;
SemanticInfo m_lastSemanticInfo; SemanticInfo m_lastSemanticInfo;
@@ -159,11 +164,11 @@ void CppEditorWidget::finalizeInitialization()
// clang-format off // clang-format off
// function combo box sorting // function combo box sorting
if (CppModelManager::supportsOutline(d->m_cppEditorDocument)) { d->m_cppEditorOutline = new CppEditorOutline(this);
d->m_cppEditorOutline = new CppEditorOutline(this);
connect(CppEditorPlugin::instance(), &CppEditorPlugin::outlineSortingChanged, // TODO: Nobody emits this signal... Remove?
outline(), &CppEditorOutline::setSorted); connect(CppEditorPlugin::instance(), &CppEditorPlugin::outlineSortingChanged,
} outline(), &CppEditorOutline::setSorted);
connect(d->m_cppEditorDocument, &CppEditorDocument::codeWarningsUpdated, connect(d->m_cppEditorDocument, &CppEditorDocument::codeWarningsUpdated,
this, &CppEditorWidget::onCodeWarningsUpdated); this, &CppEditorWidget::onCodeWarningsUpdated);
@@ -197,10 +202,10 @@ void CppEditorWidget::finalizeInitialization()
}); });
connect(&d->m_localRenaming, &CppLocalRenaming::processKeyPressNormally, connect(&d->m_localRenaming, &CppLocalRenaming::processKeyPressNormally,
this, &CppEditorWidget::processKeyNormally); this, &CppEditorWidget::processKeyNormally);
if (d->m_cppEditorOutline) { connect(this, &QPlainTextEdit::cursorPositionChanged, this, [this] {
connect(this, &QPlainTextEdit::cursorPositionChanged, if (d->shouldOfferOutline())
d->m_cppEditorOutline, &CppEditorOutline::updateIndex); d->m_cppEditorOutline->updateIndex();
} });
connect(cppEditorDocument(), &CppEditorDocument::preprocessorSettingsChanged, this, connect(cppEditorDocument(), &CppEditorDocument::preprocessorSettingsChanged, this,
[this](bool customSettings) { [this](bool customSettings) {
@@ -236,8 +241,8 @@ void CppEditorWidget::finalizeInitialization()
}); });
// Toolbar: Outline/Overview combo box // Toolbar: Outline/Overview combo box
if (d->m_cppEditorOutline) d->m_outlineAction = insertExtraToolBarWidget(TextEditorWidget::Left,
insertExtraToolBarWidget(TextEditorWidget::Left, d->m_cppEditorOutline->widget()); d->m_cppEditorOutline->widget());
// clang-format on // clang-format on
// Toolbar: '#' Button // Toolbar: '#' Button
@@ -261,6 +266,20 @@ void CppEditorWidget::finalizeInitialization()
}); });
connect(&cppEditorDocument()->minimizableInfoBars(), &MinimizableInfoBars::showAction, connect(&cppEditorDocument()->minimizableInfoBars(), &MinimizableInfoBars::showAction,
this, &CppEditorWidget::onShowInfoBarAction); this, &CppEditorWidget::onShowInfoBarAction);
d->m_outlineTimer.setInterval(5000);
d->m_outlineTimer.setSingleShot(true);
connect(&d->m_outlineTimer, &QTimer::timeout, this, [this] {
d->m_outlineAction->setVisible(d->shouldOfferOutline());
if (d->m_outlineAction->isVisible()) {
d->m_cppEditorOutline->update();
d->m_cppEditorOutline->updateIndex();
}
});
connect(&ClangdSettings::instance(), &ClangdSettings::changed,
&d->m_outlineTimer, qOverload<>(&QTimer::start));
connect(d->m_cppEditorDocument, &CppEditorDocument::changed,
&d->m_outlineTimer, qOverload<>(&QTimer::start));
} }
void CppEditorWidget::finalizeInitializationAfterDuplication(TextEditorWidget *other) void CppEditorWidget::finalizeInitializationAfterDuplication(TextEditorWidget *other)
@@ -271,7 +290,7 @@ void CppEditorWidget::finalizeInitializationAfterDuplication(TextEditorWidget *o
if (cppEditorWidget->isSemanticInfoValidExceptLocalUses()) if (cppEditorWidget->isSemanticInfoValidExceptLocalUses())
updateSemanticInfo(cppEditorWidget->semanticInfo()); updateSemanticInfo(cppEditorWidget->semanticInfo());
if (d->m_cppEditorOutline) if (d->shouldOfferOutline())
d->m_cppEditorOutline->update(); d->m_cppEditorOutline->update();
const Id selectionKind = CodeWarningsSelection; const Id selectionKind = CodeWarningsSelection;
setExtraSelections(selectionKind, cppEditorWidget->extraSelections(selectionKind)); setExtraSelections(selectionKind, cppEditorWidget->extraSelections(selectionKind));
@@ -331,7 +350,7 @@ void CppEditorWidget::selectAll()
void CppEditorWidget::onCppDocumentUpdated() void CppEditorWidget::onCppDocumentUpdated()
{ {
if (d->m_cppEditorOutline) if (d->shouldOfferOutline())
d->m_cppEditorOutline->update(); d->m_cppEditorOutline->update();
} }

View File

@@ -223,9 +223,9 @@ using SubBreakpoints = const QList<SubBreakpoint>;
using BreakHandlerModel = Utils::TreeModel<Utils::TypedTreeItem<BreakpointItem>, BreakpointItem, SubBreakpointItem>; using BreakHandlerModel = Utils::TreeModel<Utils::TypedTreeItem<BreakpointItem>, BreakpointItem, SubBreakpointItem>;
using BreakpointManagerModel = Utils::TreeModel<Utils::TypedTreeItem<GlobalBreakpointItem>, GlobalBreakpointItem>; using BreakpointManagerModel = Utils::TreeModel<Utils::TypedTreeItem<GlobalBreakpointItem>, GlobalBreakpointItem>;
inline uint qHash(const Debugger::Internal::SubBreakpoint &b) { return qHash(b.data()); } inline auto qHash(const Debugger::Internal::SubBreakpoint &b) { return qHash(b.data()); }
inline uint qHash(const Debugger::Internal::Breakpoint &b) { return qHash(b.data()); } inline auto qHash(const Debugger::Internal::Breakpoint &b) { return qHash(b.data()); }
inline uint qHash(const Debugger::Internal::GlobalBreakpoint &b) { return qHash(b.data()); } inline auto qHash(const Debugger::Internal::GlobalBreakpoint &b) { return qHash(b.data()); }
class BreakHandler : public BreakHandlerModel class BreakHandler : public BreakHandlerModel
{ {

View File

@@ -57,6 +57,7 @@
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/temporaryfile.h> #include <utils/temporaryfile.h>
#include <utils/treemodel.h> #include <utils/treemodel.h>
#include <utils/fileutils.h>
#include <QApplication> #include <QApplication>
#include <QCheckBox> #include <QCheckBox>
@@ -1045,23 +1046,33 @@ FilePath DockerDevice::symLinkTarget(const FilePath &filePath) const
return {}; return {};
} }
FilePath DockerDevice::searchInPath(const FilePath &filePath) const FilePath DockerDevice::searchInPath(const FilePath &filePath, const FilePaths &additionalDirs) const
{ {
QTC_ASSERT(handlesFile(filePath), return {});
tryCreateLocalFileAccess();
const QString path = filePath.path(); const QString path = filePath.path();
// FIXME: Check whether local search via deviceEnvironment/PATH is faster?
CommandLine dcmd{"docker", {"exec", d->m_container, "which", path}}; CommandLine dcmd{"docker", {"exec", d->m_container, "which", path}};
QtcProcess proc; QtcProcess proc;
proc.setCommand(dcmd); proc.setCommand(dcmd);
proc.setWorkingDirectory(QDir::tempPath());
proc.start(); proc.start();
proc.waitForFinished(); proc.waitForFinished();
LOG("Run sync:" << dcmd.toUserOutput() << " result: " << proc.exitCode()); LOG("Run sync:" << dcmd.toUserOutput() << " result: " << proc.exitCode());
if (proc.exitCode() != 0) if (proc.exitCode() == 0) {
return {}; const QString output = proc.stdOut().trimmed();
return mapToGlobalPath(FilePath::fromString(output));
}
const QString output = proc.stdOut().trimmed(); for (const FilePath &dir : additionalDirs) {
return mapToGlobalPath(FilePath::fromString(output)); const FilePath candidate = dir / filePath.path();
if (candidate.exists())
return candidate;
}
return {};
} }
FilePaths DockerDevice::directoryEntries(const FilePath &filePath, FilePaths DockerDevice::directoryEntries(const FilePath &filePath,

View File

@@ -88,7 +88,8 @@ public:
bool removeRecursively(const Utils::FilePath &filePath) const override; bool removeRecursively(const Utils::FilePath &filePath) const override;
bool copyFile(const Utils::FilePath &filePath, const Utils::FilePath &target) const override; bool copyFile(const Utils::FilePath &filePath, const Utils::FilePath &target) const override;
bool renameFile(const Utils::FilePath &filePath, const Utils::FilePath &target) const override; bool renameFile(const Utils::FilePath &filePath, const Utils::FilePath &target) const override;
Utils::FilePath searchInPath(const Utils::FilePath &filePath) const override; Utils::FilePath searchInPath(const Utils::FilePath &filePath,
const Utils::FilePaths &additionalDirs) const override;
Utils::FilePath symLinkTarget(const Utils::FilePath &filePath) const override; Utils::FilePath symLinkTarget(const Utils::FilePath &filePath) const override;
QList<Utils::FilePath> directoryEntries(const Utils::FilePath &filePath, QList<Utils::FilePath> directoryEntries(const Utils::FilePath &filePath,
const QStringList &nameFilters, const QStringList &nameFilters,

View File

@@ -1823,7 +1823,7 @@ bool GitClient::isRemoteCommit(const QString &workingDirectory, const QString &c
{ {
QtcProcess proc; QtcProcess proc;
vcsFullySynchronousExec(proc, workingDirectory, {"branch", "-r", "--contains", commit}, silentFlags); vcsFullySynchronousExec(proc, workingDirectory, {"branch", "-r", "--contains", commit}, silentFlags);
return proc.rawStdOut().isEmpty(); return !proc.rawStdOut().isEmpty();
} }
bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QString &branch) bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QString &branch)

View File

@@ -33,6 +33,7 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/fileutils.h>
#include <QFormLayout> #include <QFormLayout>
#include <QProcess> #include <QProcess>

View File

@@ -193,7 +193,7 @@ private:
QString m_param; QString m_param;
}; };
inline int qHash(const ProjectExplorer::Abi &abi) inline auto qHash(const ProjectExplorer::Abi &abi)
{ {
int h = abi.architecture() int h = abi.architecture()
+ (abi.os() << 3) + (abi.os() << 3)

View File

@@ -70,7 +70,7 @@ inline bool operator!=(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
return !(ti1 == ti2); return !(ti1 == ti2);
} }
inline uint qHash(const BuildTargetInfo &ti) inline auto qHash(const BuildTargetInfo &ti)
{ {
return qHash(ti.displayName) ^ qHash(ti.buildKey); return qHash(ti.displayName) ^ qHash(ti.buildKey);
} }

View File

@@ -30,6 +30,7 @@
#include <app/app_version.h> #include <app/app_version.h>
#include <utils/winutils.h> #include <utils/winutils.h>
#include <utils/fileutils.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>

View File

@@ -29,6 +29,8 @@
#include "idevice.h" #include "idevice.h"
#include "idevicefactory.h" #include "idevicefactory.h"
#include <utils/fileutils.h>
#include <QPushButton> #include <QPushButton>
namespace ProjectExplorer { namespace ProjectExplorer {

View File

@@ -458,10 +458,10 @@ DeviceManager::DeviceManager(bool isInstance) : d(std::make_unique<DeviceManager
return device->renameFile(filePath, target); return device->renameFile(filePath, target);
}; };
deviceHooks.searchInPath = [](const FilePath &filePath) { deviceHooks.searchInPath = [](const FilePath &filePath, const FilePaths &additionalDirs) {
auto device = DeviceManager::deviceForPath(filePath); auto device = DeviceManager::deviceForPath(filePath);
QTC_ASSERT(device, return FilePath{}); QTC_ASSERT(device, return FilePath{});
return device->searchInPath(filePath); return device->searchInPath(filePath, additionalDirs);
}; };
deviceHooks.symLinkTarget = [](const FilePath &filePath) { deviceHooks.symLinkTarget = [](const FilePath &filePath) {
@@ -507,6 +507,12 @@ DeviceManager::DeviceManager(bool isInstance) : d(std::make_unique<DeviceManager
return device->osType(); return device->osType();
}; };
deviceHooks.environment = [](const FilePath &filePath) {
auto device = DeviceManager::deviceForPath(filePath);
QTC_ASSERT(device, return Environment{});
return device->systemEnvironment();
};
FilePath::setDeviceFileHooks(deviceHooks); FilePath::setDeviceFileHooks(deviceHooks);
DeviceProcessHooks processHooks; DeviceProcessHooks processHooks;

View File

@@ -28,6 +28,7 @@
#include "devicemanager.h" #include "devicemanager.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <QString> #include <QString>

View File

@@ -28,6 +28,7 @@
#include "idevice.h" #include "idevice.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h>
namespace ProjectExplorer { namespace ProjectExplorer {

View File

@@ -28,6 +28,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/treemodel.h> #include <utils/treemodel.h>
#include <utils/fileutils.h>
using namespace Utils; using namespace Utils;

View File

@@ -26,6 +26,8 @@
#include "devicetestdialog.h" #include "devicetestdialog.h"
#include "ui_devicetestdialog.h" #include "ui_devicetestdialog.h"
#include <utils/fileutils.h>
#include <QBrush> #include <QBrush>
#include <QColor> #include <QColor>
#include <QFont> #include <QFont>

View File

@@ -311,7 +311,7 @@ bool IDevice::renameFile(const FilePath &filePath, const FilePath &target) const
return false; return false;
} }
FilePath IDevice::searchInPath(const FilePath &filePath) const FilePath IDevice::searchInPath(const FilePath &filePath, const FilePaths &additionalDirs) const
{ {
return Environment::systemEnvironment().searchInPath(filePath.path()); return Environment::systemEnvironment().searchInPath(filePath.path());
} }

View File

@@ -249,7 +249,8 @@ public:
virtual bool removeRecursively(const Utils::FilePath &filePath) const; virtual bool removeRecursively(const Utils::FilePath &filePath) const;
virtual bool copyFile(const Utils::FilePath &filePath, const Utils::FilePath &target) const; virtual bool copyFile(const Utils::FilePath &filePath, const Utils::FilePath &target) const;
virtual bool renameFile(const Utils::FilePath &filePath, const Utils::FilePath &target) const; virtual bool renameFile(const Utils::FilePath &filePath, const Utils::FilePath &target) const;
virtual Utils::FilePath searchInPath(const Utils::FilePath &filePath) const; virtual Utils::FilePath searchInPath(const Utils::FilePath &filePath,
const QList<Utils::FilePath> &additionalDirs = {}) const;
virtual Utils::FilePath symLinkTarget(const Utils::FilePath &filePath) const; virtual Utils::FilePath symLinkTarget(const Utils::FilePath &filePath) const;
virtual QList<Utils::FilePath> directoryEntries(const Utils::FilePath &filePath, virtual QList<Utils::FilePath> directoryEntries(const Utils::FilePath &filePath,
const QStringList &nameFilters, const QStringList &nameFilters,

View File

@@ -29,6 +29,7 @@
#include <ssh/sshremoteprocessrunner.h> #include <ssh/sshremoteprocessrunner.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h>
using namespace QSsh; using namespace QSsh;

View File

@@ -59,7 +59,7 @@ public:
HeaderPathType type = HeaderPathType::User; HeaderPathType type = HeaderPathType::User;
}; };
inline uint qHash(const HeaderPath &key, uint seed = 0) inline auto qHash(const HeaderPath &key, uint seed = 0)
{ {
return ((qHash(key.path) << 2) | uint(key.type)) ^ seed; return ((qHash(key.path) << 2) | uint(key.type)) ^ seed;
} }

View File

@@ -85,7 +85,7 @@ private:
}; };
inline inline
uint qHash(const Macro &macro) auto qHash(const Macro &macro)
{ {
using QT_PREPEND_NAMESPACE(qHash); using QT_PREPEND_NAMESPACE(qHash);
return qHash(macro.key) ^ qHash(macro.value) ^ qHash(int(macro.type)); return qHash(macro.key) ^ qHash(macro.value) ^ qHash(int(macro.type));

View File

@@ -163,13 +163,13 @@ QString ComponentNameDialog::isValid() const
QString compName = ui->componentNameEdit->text(); QString compName = ui->componentNameEdit->text();
if (compName.isEmpty() || !compName[0].isUpper()) if (compName.isEmpty() || !compName[0].isUpper())
return tr("Invalid component name"); return tr("Invalid component name.");
if (!ui->pathEdit->isValid()) if (!ui->pathEdit->isValid())
return tr("Invalid path"); return tr("Invalid path.");
if (QDir(ui->pathEdit->path()).exists(compName + u".qml")) if (QDir(ui->pathEdit->path()).exists(compName + u".qml"))
return tr("Component already exists"); return tr("Component already exists.");
return QString(); return QString();
} }

View File

@@ -148,7 +148,7 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
projectInfo.tryQmlDump = project && qtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT); projectInfo.tryQmlDump = project && qtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT);
projectInfo.qtQmlPath = qtVersion->qmlPath().toFileInfo().canonicalFilePath(); projectInfo.qtQmlPath = qtVersion->qmlPath().toFileInfo().canonicalFilePath();
projectInfo.qtVersionString = qtVersion->qtVersionString(); projectInfo.qtVersionString = qtVersion->qtVersionString();
} else if (!activeKit->value(QtSupport::SuppliesQtQuickImportPath::id(), false).toBool()) { } else if (!activeKit || !activeKit->value(QtSupport::SuppliesQtQuickImportPath::id(), false).toBool()) {
projectInfo.qtQmlPath = QFileInfo(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath)).canonicalFilePath(); projectInfo.qtQmlPath = QFileInfo(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath)).canonicalFilePath();
projectInfo.qtVersionString = QLatin1String(qVersion()); projectInfo.qtVersionString = QLatin1String(qVersion());
} }

View File

@@ -76,7 +76,7 @@ inline bool operator!=(const QmlEventLocation &location1, const QmlEventLocation
return !(location1 == location2); return !(location1 == location2);
} }
inline uint qHash(const QmlEventLocation &location) inline auto qHash(const QmlEventLocation &location)
{ {
return qHash(location.filename()) return qHash(location.filename())
^ ((location.line() & 0xfff) // 12 bits of line number ^ ((location.line() & 0xfff) // 12 bits of line number

View File

@@ -26,6 +26,7 @@
#include "qnxdeviceprocesslist.h" #include "qnxdeviceprocesslist.h"
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <QRegularExpression> #include <QRegularExpression>
#include <QStringList> #include <QStringList>

View File

@@ -25,6 +25,8 @@
#include "qnxdeviceprocesssignaloperation.h" #include "qnxdeviceprocesssignaloperation.h"
#include <utils/fileutils.h>
using namespace Qnx; using namespace Qnx;
using namespace Qnx::Internal; using namespace Qnx::Internal;

View File

@@ -28,6 +28,7 @@
#include <ssh/sshremoteprocessrunner.h> #include <ssh/sshremoteprocessrunner.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h>
namespace Qnx { namespace Qnx {
namespace Internal { namespace Internal {

View File

@@ -30,6 +30,7 @@
#include "remotelinux_constants.h" #include "remotelinux_constants.h"
#include <utils/portlist.h> #include <utils/portlist.h>
#include <utils/fileutils.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace QSsh; using namespace QSsh;

View File

@@ -26,6 +26,7 @@
#include "remotelinuxcheckforfreediskspaceservice.h" #include "remotelinuxcheckforfreediskspaceservice.h"
#include <ssh/sshremoteprocessrunner.h> #include <ssh/sshremoteprocessrunner.h>
#include <utils/fileutils.h>
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {

View File

@@ -26,6 +26,7 @@
#include "remotelinuxcustomcommanddeployservice.h" #include "remotelinuxcustomcommanddeployservice.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <ssh/sshremoteprocessrunner.h> #include <ssh/sshremoteprocessrunner.h>
using namespace QSsh; using namespace QSsh;

View File

@@ -25,6 +25,8 @@
#include "remotelinuxkillappservice.h" #include "remotelinuxkillappservice.h"
#include <utils/fileutils.h>
#
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
class RemoteLinuxKillAppServicePrivate class RemoteLinuxKillAppServicePrivate

View File

@@ -26,6 +26,7 @@
#include "remotelinuxpackageinstaller.h" #include "remotelinuxpackageinstaller.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <ssh/sshremoteprocessrunner.h> #include <ssh/sshremoteprocessrunner.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;

View File

@@ -28,6 +28,7 @@
#include <ssh/sshremoteprocessrunner.h> #include <ssh/sshremoteprocessrunner.h>
#include <ssh/sshconnection.h> #include <ssh/sshconnection.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fileutils.h>
using namespace RemoteLinux; using namespace RemoteLinux;
using namespace ProjectExplorer; using namespace ProjectExplorer;