forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/9.0' into qds/dev
Change-Id: Ic60cb293d07e7e25716adfbaa2f35e9d25ca148b
This commit is contained in:
@@ -217,16 +217,37 @@ static inline QStringList getPluginPaths()
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void setupInstallSettings(QString &installSettingspath)
|
||||
// Returns plugin path that is set in install settings.
|
||||
// The installer (or rather the packaging) can write that to load optional plugins from
|
||||
// outside the application bundle on macOS, because installing optional plugins into
|
||||
// the application bundle would break code signing.
|
||||
static QStringList getInstallPluginPaths()
|
||||
{
|
||||
// uses SystemScope because this really must be an "installation" setting
|
||||
QSettings installSettings(QSettings::IniFormat,
|
||||
QSettings::SystemScope,
|
||||
QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR),
|
||||
QLatin1String(Core::Constants::IDE_CASED_ID));
|
||||
return Utils::transform(installSettings.value("Settings/InstallPluginPaths").toStringList(),
|
||||
[](const QString &path) -> QString {
|
||||
if (QDir::isRelativePath(path))
|
||||
return applicationDirPath() + '/' + path;
|
||||
return path;
|
||||
});
|
||||
}
|
||||
|
||||
static void setupInstallSettings(QString &installSettingspath, bool redirect = true)
|
||||
{
|
||||
if (!installSettingspath.isEmpty() && !QFileInfo(installSettingspath).isDir()) {
|
||||
displayError(QString("-installsettingspath \"%0\" needs to be the path where a %1/%2.ini exist.").arg(installSettingspath,
|
||||
QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR), QLatin1String(Core::Constants::IDE_CASED_ID)));
|
||||
installSettingspath.clear();
|
||||
}
|
||||
static const char kInstallSettingsKey[] = "Settings/InstallSettings";
|
||||
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope,
|
||||
installSettingspath.isEmpty() ? resourcePath() : installSettingspath);
|
||||
QSettings::setPath(QSettings::IniFormat,
|
||||
QSettings::SystemScope,
|
||||
installSettingspath.isEmpty() ? resourcePath() : installSettingspath);
|
||||
if (!redirect) // ignore redirection via Settings/InstallSettings
|
||||
return;
|
||||
|
||||
// Check if the default install settings contain a setting for the actual install settings.
|
||||
// This can be an absolute path, or a path relative to applicationDirPath().
|
||||
@@ -236,6 +257,7 @@ static void setupInstallSettings(QString &installSettingspath)
|
||||
// yet a second time. So try this a few times.
|
||||
// (Only the first time with QSettings::UserScope, to allow setting the install settings path
|
||||
// in the user settings.)
|
||||
static const char kInstallSettingsKey[] = "Settings/InstallSettings";
|
||||
QSettings::Scope scope = QSettings::UserScope;
|
||||
int count = 0;
|
||||
bool containsInstallSettingsKey = false;
|
||||
@@ -542,9 +564,11 @@ int main(int argc, char **argv)
|
||||
|
||||
// Must be done before any QSettings class is created
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
setupInstallSettings(options.installSettingsPath);
|
||||
// plugin manager takes control of this settings object
|
||||
|
||||
// HiDPI variables need to be set before creating QApplication.
|
||||
// Since we do not have a QApplication yet, we cannot rely on QApplication::applicationDirPath()
|
||||
// though. So we set up install settings with a educated guess here, and re-setup it later.
|
||||
setupInstallSettings(options.installSettingsPath);
|
||||
setHighDpiEnvironmentVariable();
|
||||
|
||||
SharedTools::QtSingleApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
@@ -563,7 +587,11 @@ int main(int argc, char **argv)
|
||||
|
||||
const QStringList pluginArguments = app.arguments();
|
||||
|
||||
/*Initialize global settings and resetup install settings with QApplication::applicationDirPath */
|
||||
// Re-setup install settings with QApplication::applicationDirPath() available, but
|
||||
// first read install plugin paths from original install settings, without redirection
|
||||
setupInstallSettings(options.installSettingsPath, /*redirect=*/false);
|
||||
const QStringList installPluginPaths = getInstallPluginPaths();
|
||||
// Re-setup install settings for real
|
||||
setupInstallSettings(options.installSettingsPath);
|
||||
Utils::QtcSettings *settings = createUserSettings();
|
||||
Utils::QtcSettings *globalSettings
|
||||
@@ -645,7 +673,8 @@ int main(int argc, char **argv)
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
|
||||
// Load
|
||||
const QStringList pluginPaths = getPluginPaths() + options.customPluginPaths;
|
||||
const QStringList pluginPaths = getPluginPaths() + installPluginPaths
|
||||
+ options.customPluginPaths;
|
||||
PluginManager::setPluginPaths(pluginPaths);
|
||||
QMap<QString, QString> foundAppOptions;
|
||||
if (pluginArguments.size() > 1) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "ads_globals.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockareatabbar.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockareatitlebar.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockareawidget.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockcomponentsfactory.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockcontainerwidget.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockfocuscontroller.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockingstatereader.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockmanager.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockoverlay.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "docksplitter.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockwidget.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "dockwidgettab.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "elidinglabel.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "floatingdockcontainer.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "floatingdragpreview.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "iconprovider.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 Uwe Kindler
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "workspacedialog.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "workspacemodel.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#include "workspaceview.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
// This file was generated by qlalr - DO NOT EDIT!
|
||||
#include "glslparsertable_p.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
|
||||
@@ -290,7 +290,10 @@ public:
|
||||
return val.isUndefined() ? std::nullopt : std::make_optional(fromJsonValue<Error>(val));
|
||||
}
|
||||
void setError(const Error &error)
|
||||
{ m_jsonObject.insert(errorKey, QJsonValue(error)); }
|
||||
{
|
||||
QTC_CHECK(error.isValid());
|
||||
m_jsonObject.insert(errorKey, QJsonValue(error));
|
||||
}
|
||||
void clearError() { m_jsonObject.remove(errorKey); }
|
||||
|
||||
bool isValid(QString *errorMessage) const override
|
||||
|
||||
@@ -917,7 +917,7 @@ QVariant AndroidBuildApkStep::data(Utils::Id id) const
|
||||
if (id == Constants::AndroidNdkPlatform) {
|
||||
if (auto qtVersion = QtKitAspect::qtVersion(kit()))
|
||||
return AndroidConfigurations::currentConfig()
|
||||
.bestNdkPlatformMatch(AndroidManager::minimumSDK(target()), qtVersion).mid(8);
|
||||
.bestNdkPlatformMatch(AndroidManager::minimumSDK(target()), qtVersion);
|
||||
return {};
|
||||
}
|
||||
if (id == Constants::NdkLocation) {
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
static QString functionWithDataTagAsArg(const QString &func, const QString &dataTag)
|
||||
{
|
||||
if (dataTag.contains(' '))
|
||||
return '"' + func + ':' + dataTag + '"';
|
||||
return func + ':' + dataTag;
|
||||
}
|
||||
|
||||
QtTestTreeItem::QtTestTreeItem(ITestFramework *testFramework, const QString &name,
|
||||
const Utils::FilePath &filePath, TestTreeItem::Type type)
|
||||
: TestTreeItem(testFramework, name, filePath, type)
|
||||
@@ -85,6 +92,13 @@ Qt::ItemFlags QtTestTreeItem::flags(int column) const
|
||||
|
||||
Qt::CheckState QtTestTreeItem::checked() const
|
||||
{
|
||||
switch (type()) {
|
||||
case TestDataFunction:
|
||||
case TestSpecialFunction:
|
||||
return Qt::Unchecked;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return m_multiTest ? Qt::Unchecked : TestTreeItem::checked();
|
||||
}
|
||||
|
||||
@@ -133,9 +147,8 @@ ITestConfiguration *QtTestTreeItem::testConfiguration() const
|
||||
const TestTreeItem *parent = function ? function->parentItem() : nullptr;
|
||||
if (!parent)
|
||||
return nullptr;
|
||||
const QString functionWithTag = function->name() + ':' + name();
|
||||
config = new QtTestConfiguration(framework());
|
||||
config->setTestCases(QStringList(functionWithTag));
|
||||
config->setTestCases(QStringList(functionWithDataTagAsArg(function->name(), name())));
|
||||
config->setProjectFile(parent->proFile());
|
||||
config->setProject(project);
|
||||
break;
|
||||
@@ -178,7 +191,7 @@ static void fillTestConfigurationsFromCheckState(const TestTreeItem *item,
|
||||
const QString funcName = grandChild->name();
|
||||
grandChild->forFirstLevelChildren([&testCases, &funcName](ITestTreeItem *dataTag) {
|
||||
if (dataTag->checked() == Qt::Checked)
|
||||
testCases << funcName + ':' + dataTag->name();
|
||||
testCases << functionWithDataTagAsArg(funcName, dataTag->name());
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -210,7 +223,7 @@ static void collectFailedTestInfo(TestTreeItem *item, QList<ITestConfiguration *
|
||||
} else {
|
||||
func->forFirstLevelChildren([&testCases, func](ITestTreeItem *dataTag) {
|
||||
if (dataTag->data(0, FailedRole).toBool())
|
||||
testCases << func->name() + ':' + dataTag->name();
|
||||
testCases << functionWithDataTagAsArg(func->name(), dataTag->name());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -464,10 +464,9 @@ Utils::Text::Replacements ClangFormatBaseIndenter::replacements(QByteArray buffe
|
||||
bool secondTry) const
|
||||
{
|
||||
QTC_ASSERT(replacementsToKeep != ReplacementsToKeep::All, return Utils::Text::Replacements());
|
||||
QTC_ASSERT(!m_fileName.isEmpty(), return {});
|
||||
|
||||
clang::format::FormatStyle style = styleForFile();
|
||||
QByteArray originalBuffer = buffer;
|
||||
|
||||
int utf8Offset = Utils::Text::utf8NthLineOffset(m_doc, buffer, startBlock.blockNumber() + 1);
|
||||
QTC_ASSERT(utf8Offset >= 0, return Utils::Text::Replacements(););
|
||||
int utf8Length = selectedLines(m_doc, startBlock, endBlock).toUtf8().size();
|
||||
@@ -476,6 +475,7 @@ Utils::Text::Replacements ClangFormatBaseIndenter::replacements(QByteArray buffe
|
||||
if (replacementsToKeep == ReplacementsToKeep::IndentAndBefore)
|
||||
rangeStart = formattingRangeStart(startBlock, buffer, lastSaveRevision());
|
||||
|
||||
clang::format::FormatStyle style = styleForFile();
|
||||
adjustFormatStyleForLineBreak(style, replacementsToKeep);
|
||||
if (replacementsToKeep == ReplacementsToKeep::OnlyIndent) {
|
||||
CharacterContext currentCharContext = CharacterContext::Unknown;
|
||||
@@ -527,6 +527,7 @@ Utils::Text::Replacements ClangFormatBaseIndenter::replacements(QByteArray buffe
|
||||
Utils::Text::Replacements ClangFormatBaseIndenter::format(
|
||||
const TextEditor::RangesInLines &rangesInLines)
|
||||
{
|
||||
QTC_ASSERT(!m_fileName.isEmpty(), return {});
|
||||
if (rangesInLines.empty())
|
||||
return Utils::Text::Replacements();
|
||||
|
||||
|
||||
@@ -1477,7 +1477,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
if (DeviceTypeKitAspect::deviceTypeId(k) == Android::Constants::ANDROID_DEVICE_TYPE) {
|
||||
buildSteps()->appendStep(Android::Constants::ANDROID_BUILD_APK_ID);
|
||||
const auto &bs = buildSteps()->steps().constLast();
|
||||
cmd.addArg("-DANDROID_NATIVE_API_LEVEL:STRING="
|
||||
cmd.addArg("-DANDROID_PLATFORM:STRING="
|
||||
+ bs->data(Android::Constants::AndroidNdkPlatform).toString());
|
||||
auto ndkLocation = bs->data(Android::Constants::NdkLocation).value<FilePath>();
|
||||
cmd.addArg("-DANDROID_NDK:PATH=" + ndkLocation.path());
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <utils/variablechooser.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QGridLayout>
|
||||
@@ -875,6 +876,7 @@ const char CMAKE_CXX_TOOLCHAIN_KEY[] = "CMAKE_CXX_COMPILER";
|
||||
const char CMAKE_QMAKE_KEY[] = "QT_QMAKE_EXECUTABLE";
|
||||
const char CMAKE_PREFIX_PATH_KEY[] = "CMAKE_PREFIX_PATH";
|
||||
const char QTC_CMAKE_PRESET_KEY[] = "QTC_CMAKE_PRESET";
|
||||
const char QTC_KIT_DEFAULT_CONFIG_HASH[] = "QTC_KIT_DEFAULT_CONFIG_HASH";
|
||||
|
||||
class CMakeConfigurationKitAspectWidget final : public KitAspectWidget
|
||||
{
|
||||
@@ -1135,6 +1137,43 @@ CMakeConfigItem CMakeConfigurationKitAspect::cmakePresetConfigItem(const Project
|
||||
});
|
||||
}
|
||||
|
||||
void CMakeConfigurationKitAspect::setKitDefaultConfigHash(ProjectExplorer::Kit *k)
|
||||
{
|
||||
const CMakeConfig defaultConfigExpanded
|
||||
= Utils::transform(defaultConfiguration(k).toList(), [k](const CMakeConfigItem &item) {
|
||||
CMakeConfigItem expanded(item);
|
||||
expanded.value = item.expandedValue(k).toUtf8();
|
||||
return expanded;
|
||||
});
|
||||
const QByteArray kitHash = computeDefaultConfigHash(defaultConfigExpanded);
|
||||
|
||||
CMakeConfig config = configuration(k);
|
||||
config.append(CMakeConfigItem(QTC_KIT_DEFAULT_CONFIG_HASH, CMakeConfigItem::INTERNAL, kitHash));
|
||||
|
||||
setConfiguration(k, config);
|
||||
}
|
||||
|
||||
CMakeConfigItem CMakeConfigurationKitAspect::kitDefaultConfigHashItem(const ProjectExplorer::Kit *k)
|
||||
{
|
||||
const CMakeConfig config = configuration(k);
|
||||
return Utils::findOrDefault(config, [](const CMakeConfigItem &item) {
|
||||
return item.key == QTC_KIT_DEFAULT_CONFIG_HASH;
|
||||
});
|
||||
}
|
||||
|
||||
QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConfig &config)
|
||||
{
|
||||
const CMakeConfig defaultConfig = defaultConfiguration(nullptr);
|
||||
const QByteArray configValues = std::accumulate(defaultConfig.begin(),
|
||||
defaultConfig.end(),
|
||||
QByteArray(),
|
||||
[config](QByteArray &sum,
|
||||
const CMakeConfigItem &item) {
|
||||
return sum += config.valueOf(item.key);
|
||||
});
|
||||
return QCryptographicHash::hash(configValues, QCryptographicHash::Md5).toHex();
|
||||
}
|
||||
|
||||
QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const
|
||||
{
|
||||
// FIXME: Convert preload scripts
|
||||
|
||||
@@ -91,6 +91,10 @@ public:
|
||||
static void setCMakePreset(ProjectExplorer::Kit *k, const QString &presetName);
|
||||
static CMakeConfigItem cmakePresetConfigItem(const ProjectExplorer::Kit *k);
|
||||
|
||||
static void setKitDefaultConfigHash(ProjectExplorer::Kit *k);
|
||||
static CMakeConfigItem kitDefaultConfigHashItem(const ProjectExplorer::Kit *k);
|
||||
static QByteArray computeDefaultConfigHash(const CMakeConfig &config);
|
||||
|
||||
// KitAspect interface
|
||||
ProjectExplorer::Tasks validate(const ProjectExplorer::Kit *k) const final;
|
||||
void setup(ProjectExplorer::Kit *k) final;
|
||||
|
||||
@@ -46,6 +46,7 @@ struct DirectoryData
|
||||
|
||||
QString cmakePresetDisplayname;
|
||||
QString cmakePreset;
|
||||
QByteArray cmakePresetDefaultConfigHash;
|
||||
|
||||
// Kit Stuff
|
||||
FilePath cmakeBinary;
|
||||
@@ -441,6 +442,28 @@ static QString extractVisualStudioPlatformFromConfig(const CMakeConfig &config)
|
||||
return platform;
|
||||
}
|
||||
|
||||
void updateCompilerPaths(CMakeConfig &config, const Environment &env)
|
||||
{
|
||||
auto updateRelativePath = [&config, env](const QByteArray &key) {
|
||||
FilePath pathValue = config.filePathValueOf(key);
|
||||
|
||||
if (pathValue.isAbsolutePath() || pathValue.isEmpty())
|
||||
return;
|
||||
|
||||
pathValue = env.searchInPath(pathValue.fileName());
|
||||
|
||||
auto it = std::find_if(config.begin(), config.end(), [&key](const CMakeConfigItem &item) {
|
||||
return item.key == key;
|
||||
});
|
||||
QTC_ASSERT(it != config.end(), return);
|
||||
|
||||
it->value = pathValue.path().toUtf8();
|
||||
};
|
||||
|
||||
updateRelativePath("CMAKE_C_COMPILER");
|
||||
updateRelativePath("CMAKE_CXX_COMPILER");
|
||||
}
|
||||
|
||||
QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
QString *warningMessage) const
|
||||
{
|
||||
@@ -518,6 +541,7 @@ QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
}
|
||||
} else {
|
||||
config = cache;
|
||||
updateCompilerPaths(config, env);
|
||||
config << CMakeConfigItem("CMAKE_COMMAND",
|
||||
CMakeConfigItem::PATH,
|
||||
configurePreset.cmakeExecutable.value().toUtf8());
|
||||
@@ -526,6 +550,8 @@ QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
CMakeConfigItem::STRING,
|
||||
configurePreset.generator.value().toUtf8());
|
||||
}
|
||||
data->cmakePresetDefaultConfigHash = CMakeConfigurationKitAspect::computeDefaultConfigHash(
|
||||
config);
|
||||
|
||||
const FilePath qmake = qmakeFromCMakeCache(config);
|
||||
if (!qmake.isEmpty())
|
||||
@@ -662,8 +688,16 @@ bool CMakeProjectImporter::matchKit(void *directoryData, const Kit *k) const
|
||||
|
||||
bool haveCMakePreset = false;
|
||||
if (!data->cmakePreset.isEmpty()) {
|
||||
auto presetConfigItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(k);
|
||||
if (data->cmakePreset != presetConfigItem.expandedValue(k))
|
||||
const auto presetConfigItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(k);
|
||||
const auto kitConfigHashItem = CMakeConfigurationKitAspect::kitDefaultConfigHashItem(k);
|
||||
|
||||
const QString presetName = presetConfigItem.expandedValue(k);
|
||||
const bool haveSameKitConfigHash = kitConfigHashItem.isNull()
|
||||
? true
|
||||
: data->cmakePresetDefaultConfigHash
|
||||
== kitConfigHashItem.value;
|
||||
|
||||
if (data->cmakePreset != presetName || !haveSameKitConfigHash)
|
||||
return false;
|
||||
|
||||
ensureBuildDirectory(*data, k);
|
||||
@@ -701,15 +735,6 @@ Kit *CMakeProjectImporter::createKit(void *directoryData) const
|
||||
CMakeGeneratorKitAspect::setPlatform(k, data->platform);
|
||||
CMakeGeneratorKitAspect::setToolset(k, data->toolset);
|
||||
|
||||
if (!data->cmakePresetDisplayname.isEmpty()) {
|
||||
k->setUnexpandedDisplayName(
|
||||
QString("%1 (CMake preset)").arg(data->cmakePresetDisplayname));
|
||||
|
||||
CMakeConfigurationKitAspect::setCMakePreset(k, data->cmakePreset);
|
||||
}
|
||||
if (!data->cmakePreset.isEmpty())
|
||||
ensureBuildDirectory(*data, k);
|
||||
|
||||
SysRootKitAspect::setSysRoot(k, data->sysroot);
|
||||
|
||||
for (const ToolChainDescription &cmtcd : data->toolChains) {
|
||||
@@ -724,6 +749,16 @@ Kit *CMakeProjectImporter::createKit(void *directoryData) const
|
||||
ToolChainKitAspect::setToolChain(k, tcd.tcs.at(0));
|
||||
}
|
||||
|
||||
if (!data->cmakePresetDisplayname.isEmpty()) {
|
||||
k->setUnexpandedDisplayName(
|
||||
QString("%1 (CMake preset)").arg(data->cmakePresetDisplayname));
|
||||
|
||||
CMakeConfigurationKitAspect::setCMakePreset(k, data->cmakePreset);
|
||||
CMakeConfigurationKitAspect::setKitDefaultConfigHash(k);
|
||||
}
|
||||
if (!data->cmakePreset.isEmpty())
|
||||
ensureBuildDirectory(*data, k);
|
||||
|
||||
qCInfo(cmInputLog) << "Temporary Kit created.";
|
||||
});
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
|
||||
m_horizontalSpacer = new QSpacerItem(40, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
m_close = new QToolButton;
|
||||
m_close->setObjectName("closeFindToolBarButton");
|
||||
|
||||
auto findButtonsWidget = new QWidget;
|
||||
|
||||
|
||||
@@ -163,10 +163,10 @@ void GeneralSettingsWidget::fillLanguageBox() const
|
||||
QStringList(QLatin1String("qtcreator*.qm")));
|
||||
|
||||
for (const FilePath &languageFile : languageFiles) {
|
||||
const QString path = languageFile.path();
|
||||
int start = path.indexOf('_') + 1;
|
||||
int end = path.lastIndexOf('.');
|
||||
const QString locale = path.mid(start, end-start);
|
||||
const QString name = languageFile.fileName();
|
||||
int start = name.indexOf('_') + 1;
|
||||
int end = name.lastIndexOf('.');
|
||||
const QString locale = name.mid(start, end - start);
|
||||
// no need to show a language that creator will not load anyway
|
||||
if (hasQmFilesForLocale(locale, creatorTrPath.toString())) {
|
||||
QLocale tmpLocale(locale);
|
||||
|
||||
@@ -165,6 +165,9 @@ void CppCodeStylePreferencesWidget::setCodeStyle(CppCodeStylePreferences *codeSt
|
||||
setCodeStyleSettings(m_preferences->currentCodeStyleSettings(), false);
|
||||
slotCurrentPreferencesChanged(m_preferences->currentPreferences(), false);
|
||||
|
||||
m_originalCppCodeStyleSettings = cppCodeStyleSettings();
|
||||
m_originalTabSettings = tabSettings();
|
||||
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
@@ -253,6 +256,12 @@ void CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged()
|
||||
if (m_blockUpdates)
|
||||
return;
|
||||
|
||||
if (m_preferences) {
|
||||
auto current = qobject_cast<CppCodeStylePreferences *>(m_preferences->currentPreferences());
|
||||
if (current)
|
||||
current->setCodeStyleSettings(cppCodeStyleSettings());
|
||||
}
|
||||
|
||||
emit codeStyleSettingsChanged(cppCodeStyleSettings());
|
||||
updatePreview();
|
||||
}
|
||||
@@ -262,6 +271,12 @@ void CppCodeStylePreferencesWidget::slotTabSettingsChanged(const TabSettings &se
|
||||
if (m_blockUpdates)
|
||||
return;
|
||||
|
||||
if (m_preferences) {
|
||||
auto current = qobject_cast<CppCodeStylePreferences *>(m_preferences->currentPreferences());
|
||||
if (current)
|
||||
current->setTabSettings(settings);
|
||||
}
|
||||
|
||||
emit tabSettingsChanged(settings);
|
||||
updatePreview();
|
||||
}
|
||||
@@ -344,19 +359,21 @@ void CppCodeStylePreferencesWidget::addTab(CppCodeStyleWidget *page, QString tab
|
||||
|
||||
void CppCodeStylePreferencesWidget::apply()
|
||||
{
|
||||
if (m_preferences) {
|
||||
auto current = qobject_cast<CppCodeStylePreferences *>(m_preferences->currentPreferences());
|
||||
if (current) {
|
||||
current->setTabSettings(tabSettings());
|
||||
current->setCodeStyleSettings(cppCodeStyleSettings());
|
||||
}
|
||||
}
|
||||
m_originalTabSettings = tabSettings();
|
||||
m_originalCppCodeStyleSettings = cppCodeStyleSettings();
|
||||
|
||||
emit applyEmitted();
|
||||
}
|
||||
|
||||
void CppCodeStylePreferencesWidget::finish()
|
||||
{
|
||||
if (m_preferences) {
|
||||
auto current = qobject_cast<CppCodeStylePreferences *>(m_preferences->currentDelegate());
|
||||
if (current) {
|
||||
current->setCodeStyleSettings(m_originalCppCodeStyleSettings);
|
||||
current->setTabSettings(m_originalTabSettings);
|
||||
}
|
||||
}
|
||||
emit finishEmitted();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <texteditor/icodestylepreferencesfactory.h>
|
||||
#include <texteditor/tabsettings.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
|
||||
namespace TextEditor {
|
||||
class FontSettings;
|
||||
class TabSettings;
|
||||
class SnippetEditorWidget;
|
||||
class CodeStyleEditor;
|
||||
class CodeStyleEditorWidget;
|
||||
@@ -72,6 +72,8 @@ private:
|
||||
CppCodeStylePreferences *m_preferences = nullptr;
|
||||
Ui::CppCodeStyleSettingsPage *m_ui;
|
||||
QList<TextEditor::SnippetEditorWidget *> m_previews;
|
||||
CppCodeStyleSettings m_originalCppCodeStyleSettings;
|
||||
TextEditor::TabSettings m_originalTabSettings;
|
||||
bool m_blockUpdates = false;
|
||||
signals:
|
||||
void codeStyleSettingsChanged(const CppEditor::CppCodeStyleSettings &);
|
||||
|
||||
@@ -159,7 +159,7 @@ DebuggerSettings::DebuggerSettings()
|
||||
cdbBreakPointCorrection.setSettingsKey(cdbSettingsGroup, "BreakpointCorrection");
|
||||
cdbBreakPointCorrection.setDefaultValue(true);
|
||||
cdbBreakPointCorrection.setToolTip("<html><head/><body><p>" + Tr::tr(
|
||||
"Attempts to correct the location of a breakpoint based on file and line number should"
|
||||
"Attempts to correct the location of a breakpoint based on file and line number should "
|
||||
"it be in a comment or in a line for which no code is generated. "
|
||||
"The correction is based on the code model.") + "</p></body></html>");
|
||||
cdbBreakPointCorrection.setLabelText(Tr::tr("Correct breakpoint location"));
|
||||
|
||||
@@ -1891,6 +1891,7 @@ void ClientPrivate::handleMethod(const QString &method, const MessageId &id, con
|
||||
Response<JsonObject, JsonObject> response(id);
|
||||
ResponseError<JsonObject> error;
|
||||
error.setCode(ResponseError<JsonObject>::MethodNotFound);
|
||||
error.setMessage(QString("The client cannot handle the method '%1'.").arg(method));
|
||||
response.setError(error);
|
||||
sendResponse(response);
|
||||
}
|
||||
|
||||
@@ -621,15 +621,22 @@ Macros MsvcToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
|
||||
Macros predefinedMacros;
|
||||
|
||||
QStringList toProcess;
|
||||
for (const QString &arg : cxxflags) {
|
||||
if (arg.startsWith("/D") || arg.startsWith("-D")) {
|
||||
const QString define = arg.mid(2);
|
||||
predefinedMacros.append(Macro::fromKeyValue(define));
|
||||
} else if (arg.startsWith("/U") || arg.startsWith("-U")) {
|
||||
predefinedMacros.append(
|
||||
{arg.mid(2).toLocal8Bit(), ProjectExplorer::MacroType::Undefine});
|
||||
for (auto arg = cxxflags.begin(); arg != cxxflags.end(); ++arg) {
|
||||
if (arg->startsWith("/D") || arg->startsWith("-D")) {
|
||||
if (arg->length() > 2)
|
||||
predefinedMacros.append(Macro::fromKeyValue(arg->mid(2)));
|
||||
else if (std::next(arg) != cxxflags.end())
|
||||
predefinedMacros.append(Macro::fromKeyValue(*++arg));
|
||||
} else if (arg->startsWith("/U") || arg->startsWith("-U")) {
|
||||
if (arg->length() > 2) {
|
||||
predefinedMacros.append({arg->mid(2).toLocal8Bit(),
|
||||
MacroType::Undefine});
|
||||
} else if (std::next(arg) != cxxflags.end()) {
|
||||
predefinedMacros.append({(++arg)->toLocal8Bit(),
|
||||
MacroType::Undefine});
|
||||
}
|
||||
} else {
|
||||
toProcess.append(arg);
|
||||
toProcess.append(*arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -551,6 +551,11 @@ QWidget *QMakeStep::createConfigWidget()
|
||||
BuildManager::buildLists({bc->cleanSteps()});
|
||||
});
|
||||
|
||||
connect(widget, &QObject::destroyed, this, [this] {
|
||||
abisLabel = nullptr;
|
||||
abisListWidget = nullptr;
|
||||
});
|
||||
|
||||
VariableChooser::addSupportForChildWidgets(widget, macroExpander());
|
||||
|
||||
return widget;
|
||||
|
||||
@@ -24,6 +24,7 @@ ComponentNameDialog::ComponentNameDialog(QWidget *parent) :
|
||||
{
|
||||
setWindowTitle(Tr::tr("Move Component into Separate File"));
|
||||
m_componentNameEdit = new Utils::ClassNameValidatingLineEdit;
|
||||
m_componentNameEdit->setObjectName("componentNameEdit");
|
||||
m_componentNameEdit->setPlaceholderText(Tr::tr("Component Name"));
|
||||
m_messageLabel = new QLabel;
|
||||
m_pathEdit = new Utils::PathChooser;
|
||||
|
||||
@@ -930,29 +930,32 @@ static QStringList qtversionFilesToCheck()
|
||||
return Utils::transform(kSubdirsToCheck, [](const QString &dir) { return qtVersionsFile(dir); });
|
||||
}
|
||||
|
||||
static std::optional<QString> settingsDirForQtDir(const QString &qtDir)
|
||||
static std::optional<FilePath> settingsDirForQtDir(const FilePath &baseDirectory,
|
||||
const FilePath &qtDir)
|
||||
{
|
||||
const QStringList dirsToCheck = Utils::transform(kSubdirsToCheck, [qtDir](const QString &dir) {
|
||||
return QString(qtDir + '/' + dir);
|
||||
const FilePaths dirsToCheck = Utils::transform(kSubdirsToCheck, [qtDir](const QString &dir) {
|
||||
return qtDir / dir;
|
||||
});
|
||||
const QString validDir = Utils::findOrDefault(dirsToCheck, [](const QString &dir) {
|
||||
return QFile::exists(settingsFile(dir)) || QFile::exists(qtVersionsFile(dir));
|
||||
const FilePath validDir = Utils::findOrDefault(dirsToCheck, [baseDirectory](const FilePath &dir) {
|
||||
return QFile::exists(settingsFile(baseDirectory.resolvePath(dir).toString()))
|
||||
|| QFile::exists(qtVersionsFile(baseDirectory.resolvePath(dir).toString()));
|
||||
});
|
||||
if (!validDir.isEmpty())
|
||||
return validDir;
|
||||
return {};
|
||||
}
|
||||
|
||||
static bool validateQtInstallDir(FancyLineEdit *input, QString *errorString)
|
||||
static bool validateQtInstallDir(PathChooser *input, QString *errorString)
|
||||
{
|
||||
const QString qtDir = input->text();
|
||||
if (!settingsDirForQtDir(qtDir)) {
|
||||
const FilePath qtDir = input->rawFilePath();
|
||||
if (!settingsDirForQtDir(input->baseDirectory(), qtDir)) {
|
||||
if (errorString) {
|
||||
const QStringList filesToCheck = settingsFilesToCheck() + qtversionFilesToCheck();
|
||||
*errorString = "<html><body>" + Tr::tr(
|
||||
"Qt installation information was not found in \"%1\". "
|
||||
"Choose a directory that contains one of the files %2")
|
||||
.arg(qtDir, "<pre>" + filesToCheck.join('\n') + "</pre>");
|
||||
*errorString = "<html><body>"
|
||||
+ Tr::tr("Qt installation information was not found in \"%1\". "
|
||||
"Choose a directory that contains one of the files %2")
|
||||
.arg(qtDir.toUserOutput(),
|
||||
"<pre>" + filesToCheck.join('\n') + "</pre>");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -988,13 +991,14 @@ void QtOptionsPageWidget::linkWithQt()
|
||||
auto pathInput = new PathChooser;
|
||||
pathLayout->addWidget(pathInput);
|
||||
pathInput->setExpectedKind(PathChooser::ExistingDirectory);
|
||||
pathInput->setBaseDirectory(FilePath::fromString(QCoreApplication::applicationDirPath()));
|
||||
pathInput->setPromptDialogTitle(title);
|
||||
pathInput->setMacroExpander(nullptr);
|
||||
pathInput->setValidationFunction([pathInput](FancyLineEdit *input, QString *errorString) {
|
||||
if (pathInput->defaultValidationFunction()
|
||||
&& !pathInput->defaultValidationFunction()(input, errorString))
|
||||
return false;
|
||||
return validateQtInstallDir(input, errorString);
|
||||
return validateQtInstallDir(pathInput, errorString);
|
||||
});
|
||||
const std::optional<FilePath> currentLink = currentlyLinkedQtDir(nullptr);
|
||||
pathInput->setFilePath(currentLink ? *currentLink : defaultQtInstallationPath());
|
||||
@@ -1027,10 +1031,12 @@ void QtOptionsPageWidget::linkWithQt()
|
||||
|
||||
dialog.exec();
|
||||
if (dialog.result() == QDialog::Accepted) {
|
||||
const std::optional<QString> settingsDir = settingsDirForQtDir(pathInput->rawFilePath().toString());
|
||||
const std::optional<FilePath> settingsDir = settingsDirForQtDir(pathInput->baseDirectory(),
|
||||
pathInput->rawFilePath());
|
||||
if (QTC_GUARD(settingsDir)) {
|
||||
QSettings(settingsFile(Core::ICore::resourcePath().toString()), QSettings::IniFormat)
|
||||
.setValue(kInstallSettingsKey, *settingsDir);
|
||||
QSettings settings(settingsFile(Core::ICore::resourcePath().toString()),
|
||||
QSettings::IniFormat);
|
||||
settings.setValue(kInstallSettingsKey, settingsDir->toVariant());
|
||||
askForRestart = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,13 @@ void SnippetOverlay::setFinalSelection(const QTextCursor &cursor, const QColor &
|
||||
void SnippetOverlay::updateEquivalentSelections(const QTextCursor &cursor)
|
||||
{
|
||||
const int ¤tIndex = indexForCursor(cursor);
|
||||
if (currentIndex == m_finalSelectionIndex) {
|
||||
accept();
|
||||
return;
|
||||
}
|
||||
if (currentIndex < 0)
|
||||
return;
|
||||
QTC_ASSERT(currentIndex < m_selections.size(), return);
|
||||
const QString ¤tText = cursorForIndex(currentIndex).selectedText();
|
||||
const QList<int> &equivalents = m_variables.value(m_selections[currentIndex].variableIndex);
|
||||
for (int i : equivalents) {
|
||||
|
||||
@@ -4476,7 +4476,7 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data,
|
||||
|
||||
const QTextLine textLine = blockData.layout->lineAt(0);
|
||||
const QRectF rect = textLine.naturalTextRect();
|
||||
qreal x = textLine.cursorToX(0) + data.offset.x() + qMax(0, q->cursorWidth() - 1)
|
||||
qreal x = textLine.x() + data.offset.x() + qMax(0, q->cursorWidth() - 1)
|
||||
+ horizontalAdvance * m_visualIndentOffset;
|
||||
int paintColumn = 0;
|
||||
|
||||
@@ -4484,8 +4484,10 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data,
|
||||
while (paintColumn < depth) {
|
||||
if (x >= 0) {
|
||||
int paintPosition = tabSettings.positionAtColumn(text, paintColumn);
|
||||
if (blockData.layout->lineForTextPosition(paintPosition).lineNumber() != 0)
|
||||
if (q->lineWrapMode() == QPlainTextEdit::WidgetWidth
|
||||
&& blockData.layout->lineForTextPosition(paintPosition).lineNumber() != 0) {
|
||||
break;
|
||||
}
|
||||
const QPointF top(x, blockData.boundingRect.top());
|
||||
const QPointF bottom(x, blockData.boundingRect.top() + rect.height());
|
||||
const QLineF line(top, bottom);
|
||||
|
||||
Reference in New Issue
Block a user