forked from qt-creator/qt-creator
ClangTools: Inline runsettingswidget.ui
Change-Id: I696ccf0103784e638a3a8cc4a49390f569d9439d Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -40,7 +40,7 @@ add_qtc_plugin(ClangTools
|
|||||||
documentquickfixfactory.cpp documentquickfixfactory.h
|
documentquickfixfactory.cpp documentquickfixfactory.h
|
||||||
executableinfo.cpp executableinfo.h
|
executableinfo.cpp executableinfo.h
|
||||||
filterdialog.cpp filterdialog.h
|
filterdialog.cpp filterdialog.h
|
||||||
runsettingswidget.cpp runsettingswidget.h runsettingswidget.ui
|
runsettingswidget.cpp runsettingswidget.h
|
||||||
settingswidget.cpp settingswidget.h
|
settingswidget.cpp settingswidget.h
|
||||||
tidychecks.ui
|
tidychecks.ui
|
||||||
virtualfilesystemoverlay.cpp virtualfilesystemoverlay.h
|
virtualfilesystemoverlay.cpp virtualfilesystemoverlay.h
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ QtcPlugin {
|
|||||||
"filterdialog.h",
|
"filterdialog.h",
|
||||||
"runsettingswidget.cpp",
|
"runsettingswidget.cpp",
|
||||||
"runsettingswidget.h",
|
"runsettingswidget.h",
|
||||||
"runsettingswidget.ui",
|
|
||||||
"settingswidget.cpp",
|
"settingswidget.cpp",
|
||||||
"settingswidget.h",
|
"settingswidget.h",
|
||||||
"tidychecks.ui",
|
"tidychecks.ui",
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "runsettingswidget.h"
|
#include "runsettingswidget.h"
|
||||||
#include "ui_runsettingswidget.h"
|
|
||||||
|
|
||||||
#include "clangtoolssettings.h"
|
#include "clangtoolssettings.h"
|
||||||
#include "clangtoolsutils.h"
|
#include "clangtoolsutils.h"
|
||||||
@@ -11,33 +10,58 @@
|
|||||||
#include "settingswidget.h"
|
#include "settingswidget.h"
|
||||||
|
|
||||||
#include <cppeditor/clangdiagnosticconfigswidget.h>
|
#include <cppeditor/clangdiagnosticconfigswidget.h>
|
||||||
|
#include <cppeditor/clangdiagnosticconfigsselectionwidget.h>
|
||||||
|
|
||||||
|
#include <utils/layoutbuilder.h>
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QSpinBox>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace ClangTools {
|
namespace ClangTools::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
RunSettingsWidget::RunSettingsWidget(QWidget *parent)
|
RunSettingsWidget::RunSettingsWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_ui(new Ui::RunSettingsWidget)
|
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
resize(383, 125);
|
||||||
|
|
||||||
|
m_diagnosticWidget = new CppEditor::ClangDiagnosticConfigsSelectionWidget;
|
||||||
|
|
||||||
|
m_buildBeforeAnalysis = new QCheckBox(tr("Build the project before analysis"));
|
||||||
|
|
||||||
|
m_analyzeOpenFiles = new QCheckBox(tr("Analyze open files"));
|
||||||
|
|
||||||
|
m_parallelJobsSpinBox = new QSpinBox;
|
||||||
|
m_parallelJobsSpinBox->setRange(1, 32);
|
||||||
|
|
||||||
|
using namespace Layouting;
|
||||||
|
|
||||||
|
// FIXME: Let RunSettingsWidget inherit from QGroupBox?
|
||||||
|
Column {
|
||||||
|
Group {
|
||||||
|
title(tr("Run Options")),
|
||||||
|
Column {
|
||||||
|
m_diagnosticWidget,
|
||||||
|
m_buildBeforeAnalysis,
|
||||||
|
m_analyzeOpenFiles,
|
||||||
|
Row { tr("Parallel jobs:"), m_parallelJobsSpinBox, st },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.attachTo(this, WithoutMargins);
|
||||||
}
|
}
|
||||||
|
|
||||||
RunSettingsWidget::~RunSettingsWidget()
|
RunSettingsWidget::~RunSettingsWidget() = default;
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
CppEditor::ClangDiagnosticConfigsSelectionWidget *RunSettingsWidget::diagnosticSelectionWidget()
|
CppEditor::ClangDiagnosticConfigsSelectionWidget *RunSettingsWidget::diagnosticSelectionWidget()
|
||||||
{
|
{
|
||||||
return m_ui->diagnosticWidget;
|
return m_diagnosticWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CppEditor::ClangDiagnosticConfigsWidget *createEditWidget(
|
static CppEditor::ClangDiagnosticConfigsWidget *createEditWidget(
|
||||||
const CppEditor::ClangDiagnosticConfigs &configs, const Utils::Id &configToSelect)
|
const CppEditor::ClangDiagnosticConfigs &configs, const Id &configToSelect)
|
||||||
{
|
{
|
||||||
// Determine executable paths
|
// Determine executable paths
|
||||||
FilePath clangTidyPath;
|
FilePath clangTidyPath;
|
||||||
@@ -65,44 +89,43 @@ static CppEditor::ClangDiagnosticConfigsWidget *createEditWidget(
|
|||||||
|
|
||||||
void RunSettingsWidget::fromSettings(const RunSettings &s)
|
void RunSettingsWidget::fromSettings(const RunSettings &s)
|
||||||
{
|
{
|
||||||
disconnect(m_ui->diagnosticWidget, 0, 0, 0);
|
disconnect(m_diagnosticWidget, 0, 0, 0);
|
||||||
m_ui->diagnosticWidget->refresh(diagnosticConfigsModel(),
|
m_diagnosticWidget->refresh(diagnosticConfigsModel(),
|
||||||
s.diagnosticConfigId(),
|
s.diagnosticConfigId(),
|
||||||
createEditWidget);
|
createEditWidget);
|
||||||
connect(m_ui->diagnosticWidget,
|
connect(m_diagnosticWidget,
|
||||||
&CppEditor::ClangDiagnosticConfigsSelectionWidget::changed,
|
&CppEditor::ClangDiagnosticConfigsSelectionWidget::changed,
|
||||||
this,
|
this,
|
||||||
&RunSettingsWidget::changed);
|
&RunSettingsWidget::changed);
|
||||||
|
|
||||||
disconnect(m_ui->buildBeforeAnalysis, 0, 0, 0);
|
disconnect(m_buildBeforeAnalysis, 0, 0, 0);
|
||||||
m_ui->buildBeforeAnalysis->setToolTip(hintAboutBuildBeforeAnalysis());
|
m_buildBeforeAnalysis->setToolTip(hintAboutBuildBeforeAnalysis());
|
||||||
m_ui->buildBeforeAnalysis->setCheckState(s.buildBeforeAnalysis() ? Qt::Checked : Qt::Unchecked);
|
m_buildBeforeAnalysis->setCheckState(s.buildBeforeAnalysis() ? Qt::Checked : Qt::Unchecked);
|
||||||
connect(m_ui->buildBeforeAnalysis, &QCheckBox::toggled, [this](bool checked) {
|
connect(m_buildBeforeAnalysis, &QCheckBox::toggled, [this](bool checked) {
|
||||||
if (!checked)
|
if (!checked)
|
||||||
showHintAboutBuildBeforeAnalysis();
|
showHintAboutBuildBeforeAnalysis();
|
||||||
emit changed();
|
emit changed();
|
||||||
});
|
});
|
||||||
|
|
||||||
disconnect(m_ui->parallelJobsSpinBox, 0, 0, 0);
|
disconnect(m_parallelJobsSpinBox, 0, 0, 0);
|
||||||
m_ui->parallelJobsSpinBox->setValue(s.parallelJobs());
|
m_parallelJobsSpinBox->setValue(s.parallelJobs());
|
||||||
m_ui->parallelJobsSpinBox->setMinimum(1);
|
m_parallelJobsSpinBox->setMinimum(1);
|
||||||
m_ui->parallelJobsSpinBox->setMaximum(QThread::idealThreadCount());
|
m_parallelJobsSpinBox->setMaximum(QThread::idealThreadCount());
|
||||||
connect(m_ui->parallelJobsSpinBox, &QSpinBox::valueChanged, this, &RunSettingsWidget::changed);
|
connect(m_parallelJobsSpinBox, &QSpinBox::valueChanged, this, &RunSettingsWidget::changed);
|
||||||
m_ui->analyzeOpenFiles->setChecked(s.analyzeOpenFiles());
|
m_analyzeOpenFiles->setChecked(s.analyzeOpenFiles());
|
||||||
connect(m_ui->analyzeOpenFiles, &QCheckBox::toggled, this, &RunSettingsWidget::changed);
|
connect(m_analyzeOpenFiles, &QCheckBox::toggled, this, &RunSettingsWidget::changed);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunSettings RunSettingsWidget::toSettings() const
|
RunSettings RunSettingsWidget::toSettings() const
|
||||||
{
|
{
|
||||||
RunSettings s;
|
RunSettings s;
|
||||||
s.setDiagnosticConfigId(m_ui->diagnosticWidget->currentConfigId());
|
s.setDiagnosticConfigId(m_diagnosticWidget->currentConfigId());
|
||||||
s.setBuildBeforeAnalysis(m_ui->buildBeforeAnalysis->checkState() == Qt::CheckState::Checked);
|
s.setBuildBeforeAnalysis(m_buildBeforeAnalysis->checkState() == Qt::CheckState::Checked);
|
||||||
s.setParallelJobs(m_ui->parallelJobsSpinBox->value());
|
s.setParallelJobs(m_parallelJobsSpinBox->value());
|
||||||
s.setAnalyzeOpenFiles(m_ui->analyzeOpenFiles->checkState() == Qt::CheckState::Checked);
|
s.setAnalyzeOpenFiles(m_analyzeOpenFiles->checkState() == Qt::CheckState::Checked);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // ClangTools::Internal
|
||||||
} // namespace ClangTools
|
|
||||||
|
|||||||
@@ -7,19 +7,18 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace CppEditor {
|
QT_BEGIN_NAMESPACE
|
||||||
class ClangDiagnosticConfigsSelectionWidget;
|
class QCheckBox;
|
||||||
}
|
class QSpinBox;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ClangTools {
|
|
||||||
namespace Internal {
|
namespace CppEditor { class ClangDiagnosticConfigsSelectionWidget; }
|
||||||
|
|
||||||
|
namespace ClangTools::Internal {
|
||||||
|
|
||||||
class RunSettings;
|
class RunSettings;
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class RunSettingsWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
class RunSettingsWidget : public QWidget
|
class RunSettingsWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -37,8 +36,10 @@ signals:
|
|||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::RunSettingsWidget *m_ui;
|
CppEditor::ClangDiagnosticConfigsSelectionWidget *m_diagnosticWidget;
|
||||||
|
QCheckBox *m_buildBeforeAnalysis;
|
||||||
|
QCheckBox *m_analyzeOpenFiles;
|
||||||
|
QSpinBox *m_parallelJobsSpinBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // ClangTools::Internal
|
||||||
} // namespace ClangTools
|
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ClangTools::Internal::RunSettingsWidget</class>
|
|
||||||
<widget class="QWidget" name="ClangTools::Internal::RunSettingsWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>383</width>
|
|
||||||
<height>125</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<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="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Run Options</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="CppEditor::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>
|
|
||||||
<widget class="QCheckBox" name="analyzeOpenFiles">
|
|
||||||
<property name="text">
|
|
||||||
<string>Analyze open files</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="processesLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Parallel jobs:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="parallelJobsSpinBox">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>32</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>CppEditor::ClangDiagnosticConfigsSelectionWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>cppeditor/clangdiagnosticconfigsselectionwidget.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
Reference in New Issue
Block a user