forked from qt-creator/qt-creator
Clang: Add option 'Build before analysis' to project settings
Diagnostic configuration Id was already there but not the checkbox whether to build project or not. Change-Id: Icb5fc15bda5eed5e375cd90df1a96060b30bf57e Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
\image qtcreator-files-to-analyze.png
|
||||
|
||||
\li In the \uicontrol {Diagnostic Configuration} group, select
|
||||
\uicontrol Custom, and then select \uicontrol Manage to
|
||||
\uicontrol {Custom Settings}, and then select \uicontrol Manage to
|
||||
specify the Clang-Tidy and Clazy checks to perform.
|
||||
|
||||
\li Select the new custom configuration in the list of configurations
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "clangselectablefilesdialog.h"
|
||||
#include "ui_clangselectablefilesdialog.h"
|
||||
#include "ui_clangtoolsbasicsettings.h"
|
||||
|
||||
#include "clangtoolsprojectsettings.h"
|
||||
#include "clangtoolssettings.h"
|
||||
@@ -291,39 +292,54 @@ SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
|
||||
m_ui->buttons->setStandardButtons(QDialogButtonBox::Cancel);
|
||||
m_ui->buttons->addButton(m_analyzeButton, QDialogButtonBox::AcceptRole);
|
||||
|
||||
m_ui->diagnosticConfigsSelectionWidget->showLabel(false);
|
||||
CppTools::ClangDiagnosticConfigsSelectionWidget *diagnosticConfigsSelectionWidget
|
||||
= m_ui->clangToolsBasicSettings->ui()->clangDiagnosticConfigsSelectionWidget;
|
||||
QCheckBox *buildBeforeAnalysis = m_ui->clangToolsBasicSettings->ui()->buildBeforeAnalysis;
|
||||
|
||||
ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project);
|
||||
m_customDiagnosticConfig = diagnosticConfiguration(settings);
|
||||
m_buildBeforeAnalysis = settings->buildBeforeAnalysis();
|
||||
|
||||
if (settings->useGlobalSettings()) {
|
||||
m_ui->globalOrCustom->setCurrentIndex(GlobalSettings);
|
||||
m_ui->diagnosticConfigsSelectionWidget->setEnabled(false);
|
||||
m_ui->diagnosticConfigsSelectionWidget->refresh(
|
||||
m_ui->clangToolsBasicSettings->setEnabled(false);
|
||||
diagnosticConfigsSelectionWidget->refresh(
|
||||
ClangToolsSettings::instance()->savedDiagnosticConfigId());
|
||||
buildBeforeAnalysis->setCheckState(
|
||||
ClangToolsSettings::instance()->savedBuildBeforeAnalysis()
|
||||
? Qt::Checked : Qt::Unchecked);
|
||||
} else {
|
||||
m_ui->globalOrCustom->setCurrentIndex(CustomSettings);
|
||||
m_ui->diagnosticConfigsSelectionWidget->setEnabled(true);
|
||||
m_ui->diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig);
|
||||
m_ui->clangToolsBasicSettings->setEnabled(true);
|
||||
diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig);
|
||||
buildBeforeAnalysis->setCheckState(m_buildBeforeAnalysis ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
||||
connect(m_ui->globalOrCustom,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
[this](int index){
|
||||
m_ui->diagnosticConfigsSelectionWidget->setEnabled(index == CustomSettings);
|
||||
[=](int index){
|
||||
m_ui->clangToolsBasicSettings->setEnabled(index == CustomSettings);
|
||||
if (index == CustomSettings) {
|
||||
m_ui->diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig);
|
||||
diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig);
|
||||
buildBeforeAnalysis->setCheckState(m_buildBeforeAnalysis ? Qt::Checked : Qt::Unchecked);
|
||||
} else {
|
||||
m_ui->diagnosticConfigsSelectionWidget->refresh(
|
||||
diagnosticConfigsSelectionWidget->refresh(
|
||||
ClangToolsSettings::instance()->savedDiagnosticConfigId());
|
||||
buildBeforeAnalysis->setCheckState(
|
||||
ClangToolsSettings::instance()->savedBuildBeforeAnalysis()
|
||||
? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
});
|
||||
connect(m_ui->diagnosticConfigsSelectionWidget,
|
||||
connect(diagnosticConfigsSelectionWidget,
|
||||
&ClangDiagnosticConfigsSelectionWidget::currentConfigChanged,
|
||||
[this](const Core::Id ¤tConfigId) {
|
||||
if (m_ui->globalOrCustom->currentIndex() == CustomSettings)
|
||||
m_customDiagnosticConfig = currentConfigId;
|
||||
});
|
||||
connect(buildBeforeAnalysis, &QCheckBox::toggled, [this](bool checked) {
|
||||
if (m_ui->globalOrCustom->currentIndex() == CustomSettings)
|
||||
m_buildBeforeAnalysis = checked;
|
||||
});
|
||||
|
||||
// Restore selection
|
||||
if (settings->selectedDirs().isEmpty() && settings->selectedFiles().isEmpty())
|
||||
@@ -339,9 +355,9 @@ SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
|
||||
connect(CppTools::codeModelSettings().data(), &CppTools::CppCodeModelSettings::changed,
|
||||
this, [=]() {
|
||||
if (m_ui->globalOrCustom->currentIndex() == CustomSettings) {
|
||||
m_ui->diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig);
|
||||
diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig);
|
||||
} else {
|
||||
m_ui->diagnosticConfigsSelectionWidget->refresh(
|
||||
diagnosticConfigsSelectionWidget->refresh(
|
||||
ClangToolsSettings::instance()->savedDiagnosticConfigId());
|
||||
}
|
||||
});
|
||||
@@ -358,9 +374,10 @@ void SelectableFilesDialog::accept()
|
||||
{
|
||||
ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project);
|
||||
|
||||
// Save diagnostic configuration
|
||||
// Save diagnostic configuration and flag to build before analysis
|
||||
settings->setUseGlobalSettings(m_ui->globalOrCustom->currentIndex() == GlobalSettings);
|
||||
settings->setDiagnosticConfig(m_customDiagnosticConfig);
|
||||
settings->setBuildBeforeAnalysis(m_buildBeforeAnalysis);
|
||||
|
||||
// Save selection
|
||||
QSet<FileName> checkedDirs;
|
||||
|
||||
@@ -65,6 +65,7 @@ private:
|
||||
Core::Id m_customDiagnosticConfig;
|
||||
ProjectExplorer::Project *m_project;
|
||||
QPushButton *m_analyzeButton = nullptr;
|
||||
bool m_buildBeforeAnalysis = true;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -15,33 +15,44 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Diagnostic Configuration</string>
|
||||
<string>General</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QComboBox" name="globalOrCustom">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Global</string>
|
||||
</property>
|
||||
<widget class="QComboBox" name="globalOrCustom">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Global Settings</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom Settings</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</widget>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CppTools::ClangDiagnosticConfigsSelectionWidget" name="diagnosticConfigsSelectionWidget" native="true"/>
|
||||
<widget class="ClangTools::ClangToolsBasicSettings" name="clangToolsBasicSettings" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -76,9 +87,9 @@
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CppTools::ClangDiagnosticConfigsSelectionWidget</class>
|
||||
<class>ClangTools::ClangToolsBasicSettings</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>cpptools/clangdiagnosticconfigsselectionwidget.h</header>
|
||||
<header>clangtools/clangtoolsbasicsettings.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "clangtool.h"
|
||||
#include "clangtoolslogfilereader.h"
|
||||
#include "clangtoolsprojectsettings.h"
|
||||
#include "clangtoolssettings.h"
|
||||
#include "clangtoolsutils.h"
|
||||
#include "clangtoolrunner.h"
|
||||
@@ -237,12 +238,12 @@ ClangToolRunControl::ClangToolRunControl(RunControl *runControl,
|
||||
{
|
||||
addStartDependency(m_projectBuilder);
|
||||
|
||||
auto *settings = ClangToolsSettings::instance();
|
||||
m_projectBuilder->setEnabled(settings->savedBuildBeforeAnalysis());
|
||||
|
||||
connect(settings, &ClangToolsSettings::buildBeforeAnalysisChanged, this, [this](bool checked) {
|
||||
m_projectBuilder->setEnabled(checked);
|
||||
});
|
||||
ClangToolsProjectSettings *projectSettings = ClangToolsProjectSettingsManager::getSettings(
|
||||
target->project());
|
||||
if (projectSettings->useGlobalSettings())
|
||||
m_projectBuilder->setEnabled(ClangToolsSettings::instance()->savedBuildBeforeAnalysis());
|
||||
else
|
||||
m_projectBuilder->setEnabled(projectSettings->buildBeforeAnalysis());
|
||||
}
|
||||
|
||||
void ClangToolRunControl::init()
|
||||
|
||||
@@ -19,6 +19,7 @@ SOURCES += \
|
||||
clangtool.cpp \
|
||||
clangtoolruncontrol.cpp \
|
||||
clangtoolrunner.cpp \
|
||||
clangtoolsbasicsettings.cpp \
|
||||
clangtoolsdiagnostic.cpp \
|
||||
clangtoolsdiagnosticmodel.cpp \
|
||||
clangtoolslogfilereader.cpp \
|
||||
@@ -41,6 +42,7 @@ HEADERS += \
|
||||
clangtoolruncontrol.h \
|
||||
clangtoolrunner.h \
|
||||
clangtools_global.h \
|
||||
clangtoolsbasicsettings.h \
|
||||
clangtoolsconstants.h \
|
||||
clangtoolsdiagnostic.h \
|
||||
clangtoolsdiagnosticmodel.h \
|
||||
@@ -54,7 +56,8 @@ HEADERS += \
|
||||
FORMS += \
|
||||
clangtoolsprojectsettingswidget.ui \
|
||||
clangtoolsconfigwidget.ui \
|
||||
clangselectablefilesdialog.ui
|
||||
clangselectablefilesdialog.ui \
|
||||
clangtoolsbasicsettings.ui
|
||||
|
||||
equals(TEST, 1) {
|
||||
HEADERS += \
|
||||
|
||||
@@ -48,11 +48,6 @@ QtcPlugin {
|
||||
"clangselectablefilesdialog.cpp",
|
||||
"clangselectablefilesdialog.h",
|
||||
"clangselectablefilesdialog.ui",
|
||||
"clangtoolsdiagnosticview.cpp",
|
||||
"clangtoolsdiagnosticview.h",
|
||||
"clangtoolsprojectsettingswidget.cpp",
|
||||
"clangtoolsprojectsettingswidget.h",
|
||||
"clangtoolsprojectsettingswidget.ui",
|
||||
"clangtidyclazyruncontrol.cpp",
|
||||
"clangtidyclazyruncontrol.h",
|
||||
"clangtidyclazyrunner.cpp",
|
||||
@@ -66,6 +61,9 @@ QtcPlugin {
|
||||
"clangtoolrunner.cpp",
|
||||
"clangtoolrunner.h",
|
||||
"clangtools_global.h",
|
||||
"clangtoolsbasicsettings.cpp",
|
||||
"clangtoolsbasicsettings.h",
|
||||
"clangtoolsbasicsettings.ui",
|
||||
"clangtoolsconfigwidget.cpp",
|
||||
"clangtoolsconfigwidget.h",
|
||||
"clangtoolsconfigwidget.ui",
|
||||
@@ -74,10 +72,15 @@ QtcPlugin {
|
||||
"clangtoolsdiagnostic.h",
|
||||
"clangtoolsdiagnosticmodel.cpp",
|
||||
"clangtoolsdiagnosticmodel.h",
|
||||
"clangtoolsdiagnosticview.cpp",
|
||||
"clangtoolsdiagnosticview.h",
|
||||
"clangtoolslogfilereader.cpp",
|
||||
"clangtoolslogfilereader.h",
|
||||
"clangtoolsprojectsettings.cpp",
|
||||
"clangtoolsprojectsettings.h",
|
||||
"clangtoolsprojectsettingswidget.cpp",
|
||||
"clangtoolsprojectsettingswidget.h",
|
||||
"clangtoolsprojectsettingswidget.ui",
|
||||
"clangtoolssettings.cpp",
|
||||
"clangtoolssettings.h",
|
||||
"clangtoolsutils.cpp",
|
||||
|
||||
50
src/plugins/clangtools/clangtoolsbasicsettings.cpp
Normal file
50
src/plugins/clangtools/clangtoolsbasicsettings.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "clangtoolsbasicsettings.h"
|
||||
#include "ui_clangtoolsbasicsettings.h"
|
||||
|
||||
#include "clangtoolsutils.h"
|
||||
|
||||
namespace ClangTools {
|
||||
|
||||
ClangToolsBasicSettings::ClangToolsBasicSettings(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::ClangToolsBasicSettings)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
ClangToolsBasicSettings::~ClangToolsBasicSettings()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
Ui::ClangToolsBasicSettings *ClangToolsBasicSettings::ui()
|
||||
{
|
||||
return m_ui;
|
||||
}
|
||||
|
||||
} // namespace ClangTools
|
||||
49
src/plugins/clangtools/clangtoolsbasicsettings.h
Normal file
49
src/plugins/clangtools/clangtoolsbasicsettings.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace ClangTools {
|
||||
|
||||
namespace Ui { class ClangToolsBasicSettings; }
|
||||
|
||||
class ClangExecutableVersion;
|
||||
|
||||
class ClangToolsBasicSettings : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ClangToolsBasicSettings(QWidget *parent = 0);
|
||||
~ClangToolsBasicSettings();
|
||||
|
||||
Ui::ClangToolsBasicSettings *ui();
|
||||
private:
|
||||
Ui::ClangToolsBasicSettings *m_ui;
|
||||
};
|
||||
|
||||
} // namespace ClangTools
|
||||
50
src/plugins/clangtools/clangtoolsbasicsettings.ui
Normal file
50
src/plugins/clangtools/clangtoolsbasicsettings.ui
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ClangTools::ClangToolsBasicSettings</class>
|
||||
<widget class="QWidget" name="ClangTools::ClangToolsBasicSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="buildBeforeAnalysis">
|
||||
<property name="text">
|
||||
<string>Build the project before analysis</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CppTools::ClangDiagnosticConfigsSelectionWidget" name="clangDiagnosticConfigsSelectionWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CppTools::ClangDiagnosticConfigsSelectionWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>cpptools/clangdiagnosticconfigsselectionwidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "clangtoolsconfigwidget.h"
|
||||
#include "ui_clangtoolsbasicsettings.h"
|
||||
#include "ui_clangtoolsconfigwidget.h"
|
||||
|
||||
#include "clangtoolsutils.h"
|
||||
@@ -54,24 +55,27 @@ ClangToolsConfigWidget::ClangToolsConfigWidget(
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
[settings](int count) { settings->setSimultaneousProcesses(count); });
|
||||
|
||||
m_ui->buildBeforeAnalysis->setCheckState(settings->savedBuildBeforeAnalysis()
|
||||
QCheckBox *buildBeforeAnalysis = m_ui->clangToolsBasicSettings->ui()->buildBeforeAnalysis;
|
||||
buildBeforeAnalysis->setCheckState(settings->savedBuildBeforeAnalysis()
|
||||
? Qt::Checked : Qt::Unchecked);
|
||||
connect(m_ui->buildBeforeAnalysis, &QCheckBox::toggled, [settings](bool checked) {
|
||||
connect(buildBeforeAnalysis, &QCheckBox::toggled, [settings](bool checked) {
|
||||
settings->setBuildBeforeAnalysis(checked);
|
||||
});
|
||||
|
||||
m_ui->clangDiagnosticConfigsSelectionWidget->refresh(settings->savedDiagnosticConfigId());
|
||||
CppTools::ClangDiagnosticConfigsSelectionWidget *clangDiagnosticConfigsSelectionWidget
|
||||
= m_ui->clangToolsBasicSettings->ui()->clangDiagnosticConfigsSelectionWidget;
|
||||
clangDiagnosticConfigsSelectionWidget->refresh(settings->savedDiagnosticConfigId());
|
||||
|
||||
connect(m_ui->clangDiagnosticConfigsSelectionWidget,
|
||||
connect(clangDiagnosticConfigsSelectionWidget,
|
||||
&CppTools::ClangDiagnosticConfigsSelectionWidget::currentConfigChanged,
|
||||
this, [this](const Core::Id ¤tConfigId) {
|
||||
m_settings->setDiagnosticConfigId(currentConfigId);
|
||||
});
|
||||
|
||||
connect(CppTools::codeModelSettings().data(), &CppTools::CppCodeModelSettings::changed,
|
||||
this, [this]() {
|
||||
this, [=]() {
|
||||
// Settings were applied so apply also the current selection if possible.
|
||||
m_ui->clangDiagnosticConfigsSelectionWidget->refresh(m_settings->diagnosticConfigId());
|
||||
clangDiagnosticConfigsSelectionWidget->refresh(m_settings->diagnosticConfigId());
|
||||
m_settings->writeSettings();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,11 +21,7 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="buildBeforeAnalysis">
|
||||
<property name="text">
|
||||
<string>Build the project before analysis</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ClangTools::ClangToolsBasicSettings" name="clangToolsBasicSettings" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="processesLayout">
|
||||
@@ -61,9 +57,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CppTools::ClangDiagnosticConfigsSelectionWidget" name="clangDiagnosticConfigsSelectionWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -84,9 +77,9 @@
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CppTools::ClangDiagnosticConfigsSelectionWidget</class>
|
||||
<class>ClangTools::ClangToolsBasicSettings</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>cpptools/clangdiagnosticconfigsselectionwidget.h</header>
|
||||
<header>clangtools/clangtoolsbasicsettings.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Internal {
|
||||
|
||||
static const char SETTINGS_KEY_USE_GLOBAL_SETTINGS[] = "ClangTools.UseGlobalSettings";
|
||||
static const char SETTINGS_KEY_DIAGNOSTIC_CONFIG[] = "ClangTools.DiagnosticConfig";
|
||||
static const char SETTINGS_KEY_BUILD_BEFORE_ANALYSIS[] = "ClangTools.BuildBeforeAnalysis";
|
||||
static const char SETTINGS_KEY_SELECTED_DIRS[] = "ClangTools.SelectedDirs";
|
||||
static const char SETTINGS_KEY_SELECTED_FILES[] = "ClangTools.SelectedFiles";
|
||||
static const char SETTINGS_KEY_SUPPRESSED_DIAGS[] = "ClangTools.SuppressedDiagnostics";
|
||||
@@ -86,6 +87,7 @@ void ClangToolsProjectSettings::load()
|
||||
m_useGlobalSettings = useGlobalVariant.isValid() ? useGlobalVariant.toBool() : true;
|
||||
m_diagnosticConfig = Core::Id::fromSetting(
|
||||
m_project->namedSettings(SETTINGS_KEY_DIAGNOSTIC_CONFIG));
|
||||
m_buildBeforeAnalysis = m_project->namedSettings(SETTINGS_KEY_BUILD_BEFORE_ANALYSIS).toBool();
|
||||
|
||||
auto toFileName = [](const QString &s) { return Utils::FileName::fromString(s); };
|
||||
|
||||
@@ -124,6 +126,7 @@ void ClangToolsProjectSettings::store()
|
||||
{
|
||||
m_project->setNamedSettings(SETTINGS_KEY_USE_GLOBAL_SETTINGS, m_useGlobalSettings);
|
||||
m_project->setNamedSettings(SETTINGS_KEY_DIAGNOSTIC_CONFIG, m_diagnosticConfig.toSetting());
|
||||
m_project->setNamedSettings(SETTINGS_KEY_BUILD_BEFORE_ANALYSIS, m_buildBeforeAnalysis);
|
||||
|
||||
const QStringList dirs = Utils::transform(m_selectedDirs.toList(), &Utils::FileName::toString);
|
||||
m_project->setNamedSettings(SETTINGS_KEY_SELECTED_DIRS, dirs);
|
||||
@@ -164,6 +167,16 @@ void ClangToolsProjectSettings::setDiagnosticConfig(const Core::Id &diagnosticCo
|
||||
m_diagnosticConfig = diagnosticConfig;
|
||||
}
|
||||
|
||||
bool ClangToolsProjectSettings::buildBeforeAnalysis() const
|
||||
{
|
||||
return m_buildBeforeAnalysis;
|
||||
}
|
||||
|
||||
void ClangToolsProjectSettings::setBuildBeforeAnalysis(bool build)
|
||||
{
|
||||
m_buildBeforeAnalysis = build;
|
||||
}
|
||||
|
||||
ClangToolsProjectSettingsManager::ClangToolsProjectSettingsManager()
|
||||
{
|
||||
QObject::connect(ProjectExplorer::SessionManager::instance(),
|
||||
|
||||
@@ -81,6 +81,9 @@ public:
|
||||
Core::Id diagnosticConfig() const;
|
||||
void setDiagnosticConfig(const Core::Id &diagnosticConfig);
|
||||
|
||||
bool buildBeforeAnalysis() const;
|
||||
void setBuildBeforeAnalysis(bool build);
|
||||
|
||||
QSet<Utils::FileName> selectedDirs() const { return m_selectedDirs; }
|
||||
void setSelectedDirs(const QSet<Utils::FileName> &value) { m_selectedDirs = value; }
|
||||
|
||||
@@ -105,6 +108,7 @@ private:
|
||||
QSet<Utils::FileName> m_selectedDirs;
|
||||
QSet<Utils::FileName> m_selectedFiles;
|
||||
SuppressedDiagnosticsList m_suppressedDiagnostics;
|
||||
bool m_buildBeforeAnalysis = true;
|
||||
};
|
||||
|
||||
class ClangToolsProjectSettingsManager
|
||||
|
||||
@@ -73,7 +73,7 @@ bool ClangToolsSettings::savedBuildBeforeAnalysis() const
|
||||
return m_savedBuildBeforeAnalysis;
|
||||
}
|
||||
|
||||
int ClangToolsSettings::buildBeforeAnalysis() const
|
||||
bool ClangToolsSettings::buildBeforeAnalysis() const
|
||||
{
|
||||
return m_buildBeforeAnalysis;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
int simultaneousProcesses() const;
|
||||
void setSimultaneousProcesses(int processes);
|
||||
|
||||
int buildBeforeAnalysis() const;
|
||||
bool buildBeforeAnalysis() const;
|
||||
void setBuildBeforeAnalysis(bool build);
|
||||
|
||||
Core::Id diagnosticConfigId() const;
|
||||
|
||||
@@ -106,11 +106,6 @@ void ClangDiagnosticConfigsSelectionWidget::refresh(Core::Id id)
|
||||
connectToCurrentIndexChanged();
|
||||
}
|
||||
|
||||
void ClangDiagnosticConfigsSelectionWidget::showLabel(bool show)
|
||||
{
|
||||
m_label->setVisible(show);
|
||||
}
|
||||
|
||||
void ClangDiagnosticConfigsSelectionWidget::connectToClangDiagnosticConfigsDialog(QPushButton *button)
|
||||
{
|
||||
connect(button, &QPushButton::clicked, [this]() {
|
||||
|
||||
@@ -50,8 +50,6 @@ public:
|
||||
|
||||
void refresh(Core::Id id);
|
||||
|
||||
void showLabel(bool show);
|
||||
|
||||
signals:
|
||||
void currentConfigChanged(const Core::Id ¤tConfigId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user