ClangTools: Remove BasicSettingsWidget

This removes the

  [ ] Build the project before Analysis

from the run dialog as it seems unlikely that this option is useful per
project.

Change-Id: I65f2ae8d1e936883f27c360d5b7b518fd31cdf07
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Nikolai Kosjar
2019-08-29 15:10:32 +02:00
parent 58a724b489
commit 1fad60153e
14 changed files with 36 additions and 239 deletions

View File

@@ -10,7 +10,6 @@ add_qtc_plugin(ClangTools
PLUGIN_DEPENDS Core Debugger CppTools ${TST_COMPONENT} PLUGIN_DEPENDS Core Debugger CppTools ${TST_COMPONENT}
INCLUDES ${CLANG_INCLUDE_DIRS} INCLUDES ${CLANG_INCLUDE_DIRS}
SOURCES SOURCES
basicsettingswidget.cpp basicsettingswidget.h basicsettingswidget.ui
clangfileinfo.h clangfileinfo.h
clangfixitsrefactoringchanges.cpp clangfixitsrefactoringchanges.h clangfixitsrefactoringchanges.cpp clangfixitsrefactoringchanges.h
clangselectablefilesdialog.cpp clangselectablefilesdialog.h clangselectablefilesdialog.ui clangselectablefilesdialog.cpp clangselectablefilesdialog.h clangselectablefilesdialog.ui

View File

@@ -1,52 +0,0 @@
/****************************************************************************
**
** 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 "basicsettingswidget.h"
#include "ui_basicsettingswidget.h"
#include "clangtoolsutils.h"
namespace ClangTools {
namespace Internal {
BasicSettingsWidget::BasicSettingsWidget(QWidget *parent)
: QWidget(parent)
, m_ui(new Ui::BasicSettingsWidget)
{
m_ui->setupUi(this);
}
BasicSettingsWidget::~BasicSettingsWidget()
{
delete m_ui;
}
Ui::BasicSettingsWidget *BasicSettingsWidget::ui()
{
return m_ui;
}
} // namespace Internal
} // namespace ClangTools

View File

@@ -1,51 +0,0 @@
/****************************************************************************
**
** 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 Internal {
namespace Ui { class BasicSettingsWidget; }
class ClangExecutableVersion;
class BasicSettingsWidget : public QWidget
{
Q_OBJECT
public:
explicit BasicSettingsWidget(QWidget *parent = nullptr);
~BasicSettingsWidget() override;
Ui::BasicSettingsWidget *ui();
private:
Ui::BasicSettingsWidget *m_ui;
};
} // namespace Internal
} // namespace ClangTools

View File

@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ClangTools::Internal::BasicSettingsWidget</class>
<widget class="QWidget" name="ClangTools::Internal::BasicSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</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>

View File

@@ -26,7 +26,6 @@
#include "clangselectablefilesdialog.h" #include "clangselectablefilesdialog.h"
#include "ui_clangselectablefilesdialog.h" #include "ui_clangselectablefilesdialog.h"
#include "ui_basicsettingswidget.h"
#include "clangtoolsprojectsettings.h" #include "clangtoolsprojectsettings.h"
#include "clangtoolssettings.h" #include "clangtoolssettings.h"
@@ -293,57 +292,36 @@ SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
m_ui->buttons->setStandardButtons(QDialogButtonBox::Cancel); m_ui->buttons->setStandardButtons(QDialogButtonBox::Cancel);
m_ui->buttons->addButton(m_analyzeButton, QDialogButtonBox::AcceptRole); m_ui->buttons->addButton(m_analyzeButton, QDialogButtonBox::AcceptRole);
CppTools::ClangDiagnosticConfigsSelectionWidget *diagnosticConfigsSelectionWidget CppTools::ClangDiagnosticConfigsSelectionWidget *diagnosticWidget = m_ui->diagnosticWidget;
= m_ui->basicSettingsWidget->ui()->clangDiagnosticConfigsSelectionWidget;
QCheckBox *buildBeforeAnalysis = m_ui->basicSettingsWidget->ui()->buildBeforeAnalysis;
buildBeforeAnalysis->setToolTip(hintAboutBuildBeforeAnalysis());
ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project); ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project);
m_customDiagnosticConfig = diagnosticConfiguration(settings); m_customDiagnosticConfig = diagnosticConfiguration(settings);
m_buildBeforeAnalysis = settings->buildBeforeAnalysis();
if (settings->useGlobalSettings()) { if (settings->useGlobalSettings()) {
m_ui->globalOrCustom->setCurrentIndex(GlobalSettings); m_ui->globalOrCustom->setCurrentIndex(GlobalSettings);
m_ui->basicSettingsWidget->setEnabled(false); diagnosticWidget->refresh(ClangToolsSettings::instance()->savedDiagnosticConfigId());
diagnosticConfigsSelectionWidget->refresh( diagnosticWidget->setEnabled(false);
ClangToolsSettings::instance()->savedDiagnosticConfigId());
buildBeforeAnalysis->setCheckState(
ClangToolsSettings::instance()->savedBuildBeforeAnalysis()
? Qt::Checked : Qt::Unchecked);
} else { } else {
m_ui->globalOrCustom->setCurrentIndex(CustomSettings); m_ui->globalOrCustom->setCurrentIndex(CustomSettings);
m_ui->basicSettingsWidget->setEnabled(true); diagnosticWidget->refresh(m_customDiagnosticConfig);
diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig); diagnosticWidget->setEnabled(true);
buildBeforeAnalysis->setCheckState(m_buildBeforeAnalysis ? Qt::Checked : Qt::Unchecked);
} }
connect(m_ui->globalOrCustom, connect(m_ui->globalOrCustom,
QOverload<int>::of(&QComboBox::currentIndexChanged), QOverload<int>::of(&QComboBox::currentIndexChanged),
[=](int index){ [=](int index){
m_ui->basicSettingsWidget->setEnabled(index == CustomSettings); diagnosticWidget->setEnabled(index == CustomSettings);
if (index == CustomSettings) { if (index == CustomSettings)
diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig); diagnosticWidget->refresh(m_customDiagnosticConfig);
buildBeforeAnalysis->setCheckState(m_buildBeforeAnalysis ? Qt::Checked : Qt::Unchecked); else
} else { diagnosticWidget->refresh(ClangToolsSettings::instance()->savedDiagnosticConfigId());
diagnosticConfigsSelectionWidget->refresh(
ClangToolsSettings::instance()->savedDiagnosticConfigId());
buildBeforeAnalysis->setCheckState(
ClangToolsSettings::instance()->savedBuildBeforeAnalysis()
? Qt::Checked : Qt::Unchecked);
}
}); });
connect(diagnosticConfigsSelectionWidget, connect(diagnosticWidget,
&ClangDiagnosticConfigsSelectionWidget::currentConfigChanged, &ClangDiagnosticConfigsSelectionWidget::currentConfigChanged,
[this](const Core::Id &currentConfigId) { [this](const Core::Id &currentConfigId) {
if (m_ui->globalOrCustom->currentIndex() == CustomSettings) if (m_ui->globalOrCustom->currentIndex() == CustomSettings)
m_customDiagnosticConfig = currentConfigId; m_customDiagnosticConfig = currentConfigId;
}); });
connect(buildBeforeAnalysis, &QCheckBox::toggled, [this](bool checked) {
if (!checked)
showHintAboutBuildBeforeAnalysis();
if (m_ui->globalOrCustom->currentIndex() == CustomSettings)
m_buildBeforeAnalysis = checked;
});
// Restore selection // Restore selection
if (settings->selectedDirs().isEmpty() && settings->selectedFiles().isEmpty()) if (settings->selectedDirs().isEmpty() && settings->selectedFiles().isEmpty())
@@ -359,9 +337,9 @@ SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
connect(CppTools::codeModelSettings().data(), &CppTools::CppCodeModelSettings::changed, connect(CppTools::codeModelSettings().data(), &CppTools::CppCodeModelSettings::changed,
this, [=]() { this, [=]() {
if (m_ui->globalOrCustom->currentIndex() == CustomSettings) { if (m_ui->globalOrCustom->currentIndex() == CustomSettings) {
diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig); diagnosticWidget->refresh(m_customDiagnosticConfig);
} else { } else {
diagnosticConfigsSelectionWidget->refresh( diagnosticWidget->refresh(
ClangToolsSettings::instance()->savedDiagnosticConfigId()); ClangToolsSettings::instance()->savedDiagnosticConfigId());
} }
}); });
@@ -378,12 +356,11 @@ void SelectableFilesDialog::accept()
{ {
ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project); ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project);
// Save diagnostic configuration and flag to build before analysis // Save diagnostic configuration
settings->setUseGlobalSettings(m_ui->globalOrCustom->currentIndex() == GlobalSettings); settings->setUseGlobalSettings(m_ui->globalOrCustom->currentIndex() == GlobalSettings);
settings->setDiagnosticConfig(m_customDiagnosticConfig); settings->setDiagnosticConfig(m_customDiagnosticConfig);
settings->setBuildBeforeAnalysis(m_buildBeforeAnalysis);
// Save selection // Save file selection
QSet<FilePath> checkedDirs; QSet<FilePath> checkedDirs;
QSet<FilePath> checkedFiles; QSet<FilePath> checkedFiles;
m_filesModel->minimalSelection(checkedDirs, checkedFiles); m_filesModel->minimalSelection(checkedDirs, checkedFiles);

View File

@@ -65,7 +65,6 @@ private:
Core::Id m_customDiagnosticConfig; Core::Id m_customDiagnosticConfig;
ProjectExplorer::Project *m_project; ProjectExplorer::Project *m_project;
QPushButton *m_analyzeButton = nullptr; QPushButton *m_analyzeButton = nullptr;
bool m_buildBeforeAnalysis = true;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -19,7 +19,7 @@
<property name="title"> <property name="title">
<string>General</string> <string>General</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@@ -52,7 +52,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="ClangTools::Internal::BasicSettingsWidget" name="basicSettingsWidget" native="true"/> <widget class="CppTools::ClangDiagnosticConfigsSelectionWidget" name="diagnosticWidget" native="true"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -87,9 +87,9 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>ClangTools::Internal::BasicSettingsWidget</class> <class>CppTools::ClangDiagnosticConfigsSelectionWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>clangtools/basicsettingswidget.h</header> <header>cpptools/clangdiagnosticconfigsselectionwidget.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -29,7 +29,6 @@
#include "clangtidyclazytool.h" #include "clangtidyclazytool.h"
#include "clangtool.h" #include "clangtool.h"
#include "clangtoolslogfilereader.h" #include "clangtoolslogfilereader.h"
#include "clangtoolsprojectsettings.h"
#include "clangtoolssettings.h" #include "clangtoolssettings.h"
#include "clangtoolsutils.h" #include "clangtoolsutils.h"
@@ -247,13 +246,7 @@ ClangToolRunWorker::ClangToolRunWorker(RunControl *runControl,
if (!preventBuild) { if (!preventBuild) {
m_projectBuilder = new ProjectBuilder(runControl); m_projectBuilder = new ProjectBuilder(runControl);
addStartDependency(m_projectBuilder); addStartDependency(m_projectBuilder);
m_projectBuilder->setEnabled(ClangToolsSettings::instance()->savedBuildBeforeAnalysis());
ClangToolsProjectSettings *projectSettings = ClangToolsProjectSettingsManager::getSettings(
runControl->project());
if (projectSettings->useGlobalSettings())
m_projectBuilder->setEnabled(ClangToolsSettings::instance()->savedBuildBeforeAnalysis());
else
m_projectBuilder->setEnabled(projectSettings->buildBeforeAnalysis());
} }
Target *target = runControl->target(); Target *target = runControl->target();
@@ -510,8 +503,7 @@ void ClangToolRunWorker::finalize()
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID); TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
Target *target = runControl()->target(); Target *target = runControl()->target();
if (target && !target->activeBuildConfiguration()->buildDirectory().exists() if (target && !target->activeBuildConfiguration()->buildDirectory().exists()
&& !ClangToolsProjectSettingsManager::getSettings(target->project()) && !ClangToolsSettings::instance()->savedBuildBeforeAnalysis()) {
->buildBeforeAnalysis()) {
msg = tr("%1: You might need to build the project to generate or update source " msg = tr("%1: You might need to build the project to generate or update source "
"files. To build automatically, enable \"Build the project before starting " "files. To build automatically, enable \"Build the project before starting "
"analysis\".") "analysis\".")

View File

@@ -16,7 +16,6 @@ isEmpty(EXTERNAL_YAML_CPP_FOUND) {
} }
SOURCES += \ SOURCES += \
basicsettingswidget.cpp \
clangfixitsrefactoringchanges.cpp \ clangfixitsrefactoringchanges.cpp \
clangselectablefilesdialog.cpp \ clangselectablefilesdialog.cpp \
clangtoolsdiagnosticview.cpp \ clangtoolsdiagnosticview.cpp \
@@ -36,7 +35,6 @@ SOURCES += \
settingswidget.cpp \ settingswidget.cpp \
HEADERS += \ HEADERS += \
basicsettingswidget.h \
clangfileinfo.h \ clangfileinfo.h \
clangfixitsrefactoringchanges.h \ clangfixitsrefactoringchanges.h \
clangselectablefilesdialog.h \ clangselectablefilesdialog.h \
@@ -59,7 +57,6 @@ HEADERS += \
settingswidget.h \ settingswidget.h \
FORMS += \ FORMS += \
basicsettingswidget.ui \
clangtoolsprojectsettingswidget.ui \ clangtoolsprojectsettingswidget.ui \
settingswidget.ui \ settingswidget.ui \

View File

@@ -31,9 +31,6 @@ QtcPlugin {
cpp.rpaths: base.concat(libclang.llvmLibDir) cpp.rpaths: base.concat(libclang.llvmLibDir)
files: [ files: [
"basicsettingswidget.cpp",
"basicsettingswidget.h",
"basicsettingswidget.ui",
"clangfileinfo.h", "clangfileinfo.h",
"clangfixitsrefactoringchanges.cpp", "clangfixitsrefactoringchanges.cpp",
"clangfixitsrefactoringchanges.h", "clangfixitsrefactoringchanges.h",

View File

@@ -36,7 +36,6 @@ namespace Internal {
static const char SETTINGS_KEY_USE_GLOBAL_SETTINGS[] = "ClangTools.UseGlobalSettings"; static const char SETTINGS_KEY_USE_GLOBAL_SETTINGS[] = "ClangTools.UseGlobalSettings";
static const char SETTINGS_KEY_DIAGNOSTIC_CONFIG[] = "ClangTools.DiagnosticConfig"; 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_DIRS[] = "ClangTools.SelectedDirs";
static const char SETTINGS_KEY_SELECTED_FILES[] = "ClangTools.SelectedFiles"; static const char SETTINGS_KEY_SELECTED_FILES[] = "ClangTools.SelectedFiles";
static const char SETTINGS_KEY_SUPPRESSED_DIAGS[] = "ClangTools.SuppressedDiagnostics"; static const char SETTINGS_KEY_SUPPRESSED_DIAGS[] = "ClangTools.SuppressedDiagnostics";
@@ -86,9 +85,6 @@ void ClangToolsProjectSettings::load()
m_diagnosticConfig = Core::Id::fromSetting( m_diagnosticConfig = Core::Id::fromSetting(
m_project->namedSettings(SETTINGS_KEY_DIAGNOSTIC_CONFIG)); m_project->namedSettings(SETTINGS_KEY_DIAGNOSTIC_CONFIG));
const QVariant value = m_project->namedSettings(SETTINGS_KEY_BUILD_BEFORE_ANALYSIS);
m_buildBeforeAnalysis = value.isValid() ? value.toBool() : true;
auto toFileName = [](const QString &s) { return Utils::FilePath::fromString(s); }; auto toFileName = [](const QString &s) { return Utils::FilePath::fromString(s); };
const QStringList dirs = m_project->namedSettings(SETTINGS_KEY_SELECTED_DIRS).toStringList(); const QStringList dirs = m_project->namedSettings(SETTINGS_KEY_SELECTED_DIRS).toStringList();
@@ -123,7 +119,6 @@ void ClangToolsProjectSettings::store()
{ {
m_project->setNamedSettings(SETTINGS_KEY_USE_GLOBAL_SETTINGS, m_useGlobalSettings); 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_DIAGNOSTIC_CONFIG, m_diagnosticConfig.toSetting());
m_project->setNamedSettings(SETTINGS_KEY_BUILD_BEFORE_ANALYSIS, m_buildBeforeAnalysis);
const QStringList dirs = Utils::transform<QList>(m_selectedDirs, &Utils::FilePath::toString); const QStringList dirs = Utils::transform<QList>(m_selectedDirs, &Utils::FilePath::toString);
m_project->setNamedSettings(SETTINGS_KEY_SELECTED_DIRS, dirs); m_project->setNamedSettings(SETTINGS_KEY_SELECTED_DIRS, dirs);
@@ -162,16 +157,6 @@ void ClangToolsProjectSettings::setDiagnosticConfig(const Core::Id &diagnosticCo
m_diagnosticConfig = diagnosticConfig; m_diagnosticConfig = diagnosticConfig;
} }
bool ClangToolsProjectSettings::buildBeforeAnalysis() const
{
return m_buildBeforeAnalysis;
}
void ClangToolsProjectSettings::setBuildBeforeAnalysis(bool build)
{
m_buildBeforeAnalysis = build;
}
ClangToolsProjectSettingsManager::ClangToolsProjectSettingsManager() ClangToolsProjectSettingsManager::ClangToolsProjectSettingsManager()
{ {
QObject::connect(ProjectExplorer::SessionManager::instance(), QObject::connect(ProjectExplorer::SessionManager::instance(),

View File

@@ -76,9 +76,6 @@ public:
Core::Id diagnosticConfig() const; Core::Id diagnosticConfig() const;
void setDiagnosticConfig(const Core::Id &diagnosticConfig); void setDiagnosticConfig(const Core::Id &diagnosticConfig);
bool buildBeforeAnalysis() const;
void setBuildBeforeAnalysis(bool build);
QSet<Utils::FilePath> selectedDirs() const { return m_selectedDirs; } QSet<Utils::FilePath> selectedDirs() const { return m_selectedDirs; }
void setSelectedDirs(const QSet<Utils::FilePath> &value) { m_selectedDirs = value; } void setSelectedDirs(const QSet<Utils::FilePath> &value) { m_selectedDirs = value; }
@@ -103,7 +100,6 @@ private:
QSet<Utils::FilePath> m_selectedDirs; QSet<Utils::FilePath> m_selectedDirs;
QSet<Utils::FilePath> m_selectedFiles; QSet<Utils::FilePath> m_selectedFiles;
SuppressedDiagnosticsList m_suppressedDiagnostics; SuppressedDiagnosticsList m_suppressedDiagnostics;
bool m_buildBeforeAnalysis = true;
}; };
class ClangToolsProjectSettingsManager class ClangToolsProjectSettingsManager

View File

@@ -25,7 +25,6 @@
#include "settingswidget.h" #include "settingswidget.h"
#include "ui_basicsettingswidget.h"
#include "ui_settingswidget.h" #include "ui_settingswidget.h"
#include "clangtoolsconstants.h" #include "clangtoolsconstants.h"
@@ -124,7 +123,7 @@ SettingsWidget::SettingsWidget(ClangToolsSettings *settings, QWidget *parent)
QOverload<int>::of(&QSpinBox::valueChanged), QOverload<int>::of(&QSpinBox::valueChanged),
[settings](int count) { settings->setSimultaneousProcesses(count); }); [settings](int count) { settings->setSimultaneousProcesses(count); });
QCheckBox *buildBeforeAnalysis = m_ui->basicSettingsWidget->ui()->buildBeforeAnalysis; QCheckBox *buildBeforeAnalysis = m_ui->buildBeforeAnalysis;
buildBeforeAnalysis->setToolTip(hintAboutBuildBeforeAnalysis()); buildBeforeAnalysis->setToolTip(hintAboutBuildBeforeAnalysis());
buildBeforeAnalysis->setCheckState(settings->savedBuildBeforeAnalysis() buildBeforeAnalysis->setCheckState(settings->savedBuildBeforeAnalysis()
? Qt::Checked : Qt::Unchecked); ? Qt::Checked : Qt::Unchecked);
@@ -134,11 +133,10 @@ SettingsWidget::SettingsWidget(ClangToolsSettings *settings, QWidget *parent)
settings->setBuildBeforeAnalysis(checked); settings->setBuildBeforeAnalysis(checked);
}); });
CppTools::ClangDiagnosticConfigsSelectionWidget *clangDiagnosticConfigsSelectionWidget CppTools::ClangDiagnosticConfigsSelectionWidget *diagnosticWidget = m_ui->diagnosticWidget;
= m_ui->basicSettingsWidget->ui()->clangDiagnosticConfigsSelectionWidget; diagnosticWidget->refresh(settings->savedDiagnosticConfigId());
clangDiagnosticConfigsSelectionWidget->refresh(settings->savedDiagnosticConfigId());
connect(clangDiagnosticConfigsSelectionWidget, connect(diagnosticWidget,
&CppTools::ClangDiagnosticConfigsSelectionWidget::currentConfigChanged, &CppTools::ClangDiagnosticConfigsSelectionWidget::currentConfigChanged,
this, [this](const Core::Id &currentConfigId) { this, [this](const Core::Id &currentConfigId) {
m_settings->setDiagnosticConfigId(currentConfigId); m_settings->setDiagnosticConfigId(currentConfigId);
@@ -147,7 +145,7 @@ SettingsWidget::SettingsWidget(ClangToolsSettings *settings, QWidget *parent)
connect(CppTools::codeModelSettings().data(), &CppTools::CppCodeModelSettings::changed, connect(CppTools::codeModelSettings().data(), &CppTools::CppCodeModelSettings::changed,
this, [=]() { this, [=]() {
// Settings were applied so apply also the current selection if possible. // Settings were applied so apply also the current selection if possible.
clangDiagnosticConfigsSelectionWidget->refresh(m_settings->diagnosticConfigId()); diagnosticWidget->refresh(m_settings->diagnosticConfigId());
m_settings->writeSettings(); m_settings->writeSettings();
}); });
} }

View File

@@ -50,7 +50,14 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="ClangTools::Internal::BasicSettingsWidget" name="basicSettingsWidget" native="true"/> <widget class="CppTools::ClangDiagnosticConfigsSelectionWidget" name="diagnosticWidget" native="true"/>
</item>
<item>
<widget class="QCheckBox" name="buildBeforeAnalysis">
<property name="text">
<string>Build the project before analysis</string>
</property>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="processesLayout"> <layout class="QHBoxLayout" name="processesLayout">
@@ -106,9 +113,9 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>ClangTools::Internal::BasicSettingsWidget</class> <class>CppTools::ClangDiagnosticConfigsSelectionWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>clangtools/basicsettingswidget.h</header> <header>cpptools/clangdiagnosticconfigsselectionwidget.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>Utils::PathChooser</class> <class>Utils::PathChooser</class>