Merge remote-tracking branch 'origin/8.0'

Conflicts:
	src/plugins/clangcodemodel/clangdclient.cpp
	src/plugins/projectexplorer/kitmanagerconfigwidget.cpp

Change-Id: Id1454bfe8e4f283f3b06ac6945aced2975814161
This commit is contained in:
Eike Ziller
2022-07-28 11:53:13 +02:00
9 changed files with 116 additions and 28 deletions

View File

@@ -438,9 +438,100 @@ FilePath FileUtils::homePath()
/*! \class Utils::FilePath
\brief The FilePath class is a light-weight convenience class for filenames.
\brief The FilePath class is an abstraction for handles to objects
in a (possibly remote) file system, similar to a URL or, in the local
case, a path to a file or directory.
On windows filenames are compared case insensitively.
Ideally, all of \QC code should use FilePath for this purpose,
but for historic reasons there are still large parts using QString.
FilePaths are internally stored as triple of strings, with one
part ("scheme") identifying an access method, a second part ("host")
a file system (e.g. a host) and a third part ("path") identifying
a (potential) object on the systems.
FilePath follows the Unix paradigm of "everything is a file":
There is no conceptional difference between FilePaths referring
to plain files or directories.
A FilePath is implicitly associated with an operating system via its
host part. The path part of a FilePath is internally stored
with forward slashes, independent of the associated OS.
The path parts of FilePaths associated with Windows (and macOS,
unless selected otherwise in the settings) are compared case-insensitively
to each other.
Note that comparisons for equivalence generally need out-of-band
knowledge, as there may be multiple FilePath representations for
the same file (e.g. different access methods may lead to the same
file).
There are several conversions between FilePath and other string-like
representations:
\list
\li FilePath::fromUserInput()
Convert string-like data from sources originating outside of
\QC, e.g. from human input in GUI controls, from environment
variables and from command-line parameters to \QC.
The input can contain both slashes and backslashes and will
be parsed and normalized.
\li FilePath::nativePath()
Converts the FilePath to the slash convention of the associated
OS and drops the scheme and host parts.
This is useful to interact with the facilities of the associated
OS, e.g. when passing this FilePath as an argument to a command
executed on the associated OS.
\note The FilePath passed as executable to a CommandLine is typically
not touched by user code. QtcProcess will use it to determine
the remote system and apply the necessary conversions internally.
\li FilePath::toUserOutput()
Converts the FilePath to the slash convention of the associated
OS and retains the scheme and host parts.
This is rarely useful for remote paths as there is practically
no consumer of this style.
\li FilePath::displayName()
Converts the FilePath to the slash convention of the associated
OS and adds the scheme and host as a " on <device>" suffix.
This is useful for static user-facing output in he GUI
\li FilePath::fromVariant(), FilePath::toVariant()
These are used to interface QVariant-based API, e.g.
settings or item model (internal) data.
\li FilePath::fromString(), FilePath::toString()
These are used for internal interfaces to code areas that
still use QString based file paths.
\endlist
Conversion of string-like data should always happen at the outer boundary
of \QC code, using \c fromUserInput() for in-bound communication,
and depending on the medium \c nativePath() or \c displayName() for out-bound
communication.
Communication with QVariant based Qt API should use \c fromVariant() and
\c toVariant().
Uses of \c fromString() and \c toString() should be phased out by transforming
code from QString based file path to FilePath. An exception here are
fragments of paths of a FilePath that are later used with \c pathAppended()
or similar which should be kept as QString.
*/
FilePath::FilePath()

View File

@@ -262,7 +262,6 @@ static BaseClientInterface *clientInterface(Project *project, const Utils::FileP
indexingOption += "=0";
const QString headerInsertionOption = QString("--header-insertion=")
+ (settings.autoIncludeHeaders() ? "iwyu" : "never");
#ifdef WITH_TESTS
// For the #include < test, which needs to get a local header file, but the list
// is being flooded with system include headers. 4280 on Windows!
@@ -270,8 +269,12 @@ static BaseClientInterface *clientInterface(Project *project, const Utils::FileP
#else
const QString limitResults = QString("--limit-results=%1").arg(settings.completionResults());
#endif
Utils::CommandLine cmd{settings.clangdFilePath(), {indexingOption, headerInsertionOption,
limitResults, "--limit-references=0", "--clang-tidy=0"}};
Utils::CommandLine cmd{settings.clangdFilePath(),
{indexingOption,
headerInsertionOption,
limitResults,
"--limit-references=0",
"--clang-tidy=0"}};
if (settings.workerThreadLimit() != 0)
cmd.addArg("-j=" + QString::number(settings.workerThreadLimit()));
if (!jsonDbDir.isEmpty())

View File

@@ -153,6 +153,9 @@ void CompilationDbParser::parserJobFinished()
void CompilationDbParser::finish(ParseResult result)
{
if (result != ParseResult::Failure)
m_guard.markAsSuccess();
emit finished(result);
deleteLater();
}

View File

@@ -69,7 +69,6 @@ public:
QList<ProjectExplorer::FileNode *> scannedFiles() const;
DbContents dbContents() const
{
m_guard.markAsSuccess();
return m_dbContents;
}

View File

@@ -105,6 +105,8 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
m_pathsListEdit->setToolTip(Tr::tr("Maps paths in this list one-to-one to the "
"docker container."));
m_pathsListEdit->setPathList(data.mounts);
m_pathsListEdit->setMaximumHeight(100);
m_pathsListEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
auto markupMounts = [this, pathListLabel] {
const bool isEmpty = m_pathsListEdit->pathList().isEmpty();

View File

@@ -68,7 +68,7 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k) :
{
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
QLabel *label = new QLabel(tr("Name:"));
auto label = new QLabel(tr("Name:"));
label->setToolTip(tr("Kit name and icon."));
QString toolTip =
@@ -81,16 +81,19 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k) :
Q_ASSERT(fileSystemFriendlyNameRegexp.isValid());
m_fileSystemFriendlyNameLineEdit->setValidator(new QRegularExpressionValidator(fileSystemFriendlyNameRegexp, m_fileSystemFriendlyNameLineEdit));
label = new QLabel(tr("File system name:"));
label->setToolTip(toolTip);
auto fsLabel = new QLabel(tr("File system name:"));
fsLabel->setToolTip(toolTip);
connect(m_fileSystemFriendlyNameLineEdit, &QLineEdit::textChanged,
this, &KitManagerConfigWidget::setFileSystemFriendlyName);
using namespace Layouting;
Grid {
AlignAsFormLabel(label), m_nameEdit, m_iconButton, br,
AlignAsFormLabel(label), m_fileSystemFriendlyNameLineEdit
}.attachTo(this);
Grid{AlignAsFormLabel(label),
m_nameEdit,
m_iconButton,
br,
AlignAsFormLabel(fsLabel),
m_fileSystemFriendlyNameLineEdit}
.attachTo(this);
m_iconButton->setToolTip(tr("Kit icon."));
auto setIconAction = new QAction(tr("Select Icon..."), this);

View File

@@ -137,8 +137,8 @@ void SanitizerParser::flush()
setDetailsFormat(m_task, m_linkSpecs);
static const int maxLen = 50;
if (m_task.details.length() > maxLen) {
const auto cutOffIt = std::next(m_task.details.begin(), maxLen);
m_task.details.insert(cutOffIt, "...");
auto cutOffIt = std::next(m_task.details.begin(), maxLen);
cutOffIt = m_task.details.insert(cutOffIt, "...");
m_task.details.erase(std::next(cutOffIt), std::prev(m_task.details.end()));
}
scheduleTask(m_task, m_task.details.count());

View File

@@ -125,18 +125,6 @@ PropertyName MaterialEditorQmlBackend::auxNamePostFix(const PropertyName &proper
return propertyName + "__AUX";
}
QVariant MaterialEditorQmlBackend::properDefaultAuxiliaryProperties(const QmlObjectNode &qmlObjectNode,
const PropertyName &propertyName)
{
const ModelNode node = qmlObjectNode.modelNode();
const PropertyName auxName = propertyName;
if (node.hasAuxiliaryData(auxName))
return node.auxiliaryData(auxName);
return {};
}
void MaterialEditorQmlBackend::createPropertyEditorValue(const QmlObjectNode &qmlObjectNode,
const PropertyName &name,
const QVariant &value,

View File

@@ -79,7 +79,6 @@ private:
const PropertyName &name, const QVariant &value,
MaterialEditorView *materialEditor);
PropertyName auxNamePostFix(const PropertyName &propertyName);
QVariant properDefaultAuxiliaryProperties(const QmlObjectNode &qmlObjectNode, const PropertyName &propertyName);
QQuickWidget *m_view = nullptr;
Internal::QmlAnchorBindingProxy m_backendAnchorBinding;