Merge remote-tracking branch 'origin/9.0'

Conflicts:
	src/plugins/cppeditor/cppcodestylesettingspage.h

Change-Id: I1aa4e2f9efc6d9cf9f284aef1abf148be9b93a60
This commit is contained in:
Eike Ziller
2023-01-10 15:44:55 +01:00
10 changed files with 115 additions and 28 deletions

View File

@@ -7,7 +7,8 @@ on:
- 'doc/**'
env:
QT_VERSION: 6.4.0
QT_VERSION: 6.4.2
MACOS_DEPLOYMENT_TARGET: 10.14
CLANG_VERSION: 15.0.0
ELFUTILS_VERSION: 0.175
CMAKE_VERSION: 3.21.1
@@ -489,7 +490,7 @@ jobs:
run: |
set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }})
set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.13")
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${{ env.MACOS_DEPLOYMENT_TARGET }}")
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
execute_process(

View File

@@ -10,7 +10,7 @@ instructions:
variableValue: http://master.qt.io/development_releases/prebuilt/libclang/libclang-release_15.0.0-based
- type: EnvironmentVariable
variableName: QTC_QT_BASE_URL
variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.4/6.4.0-released/Qt"
variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.4/6.4.2-released/Qt"
- type: EnvironmentVariable
variableName: QTC_QT_MODULES
variableValue: "qt5compat qtbase qtdeclarative qtimageformats qtquick3d qtquickcontrols2 qtquicktimeline qtserialport qtshadertools qtsvg qttools qttranslations qtwebengine"

View File

@@ -239,7 +239,6 @@ class DumperBase():
def setFallbackQtVersion(self, args):
version = int(args.get('version', self.fallbackQtVersion))
DumperBase.warn("got fallback qt version 0x%x" % version)
self.fallbackQtVersion = version
def resetPerStepCaches(self):

View File

@@ -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());
});
}
});

View File

@@ -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

View File

@@ -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;

View File

@@ -46,6 +46,7 @@ struct DirectoryData
QString cmakePresetDisplayname;
QString cmakePreset;
QByteArray cmakePresetDefaultConfigHash;
// Kit Stuff
FilePath cmakeBinary;
@@ -549,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())
@@ -685,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);
@@ -724,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) {
@@ -747,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.";
});
}

View File

@@ -360,6 +360,9 @@ void CppCodeStylePreferencesWidget::setCodeStyle(CppCodeStylePreferences *codeSt
setCodeStyleSettings(m_preferences->currentCodeStyleSettings(), false);
slotCurrentPreferencesChanged(m_preferences->currentPreferences(), false);
m_originalCppCodeStyleSettings = cppCodeStyleSettings();
m_originalTabSettings = tabSettings();
updatePreview();
}
@@ -445,6 +448,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();
}
@@ -454,6 +463,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();
}
@@ -536,19 +551,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();
}

View File

@@ -7,13 +7,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;
@@ -70,6 +70,8 @@ private:
CppCodeStylePreferences *m_preferences = nullptr;
CppCodeStylePreferencesWidgetPrivate *d = nullptr;
CppCodeStyleSettings m_originalCppCodeStyleSettings;
TextEditor::TabSettings m_originalTabSettings;
bool m_blockUpdates = false;
friend class CppCodeStylePreferencesWidgetPrivate;
signals:

View File

@@ -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"));