summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-09-26 16:36:15 +0200
committerhjk <hjk@qt.io>2022-09-27 16:32:24 +0000
commit957a26d37961bcf95e535ced802a2d9e28447c29 (patch)
tree2ca9d77a696cfc89203f61599edc20899abfab3f
parent3fdc5ca61fd2d3ac3464e72d02d34338a116fc6b (diff)
downloadqt-creator-957a26d37961bcf95e535ced802a2d9e28447c29.tar.gz
ClangTools: Inline runsettingswidget.ui
Change-Id: I696ccf0103784e638a3a8cc4a49390f569d9439d Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
-rw-r--r--src/plugins/clangtools/CMakeLists.txt2
-rw-r--r--src/plugins/clangtools/clangtools.qbs1
-rw-r--r--src/plugins/clangtools/runsettingswidget.cpp89
-rw-r--r--src/plugins/clangtools/runsettingswidget.h25
-rw-r--r--src/plugins/clangtools/runsettingswidget.ui97
5 files changed, 70 insertions, 144 deletions
diff --git a/src/plugins/clangtools/CMakeLists.txt b/src/plugins/clangtools/CMakeLists.txt
index 9e2d4db645..2b67989b2f 100644
--- a/src/plugins/clangtools/CMakeLists.txt
+++ b/src/plugins/clangtools/CMakeLists.txt
@@ -40,7 +40,7 @@ add_qtc_plugin(ClangTools
documentquickfixfactory.cpp documentquickfixfactory.h
executableinfo.cpp executableinfo.h
filterdialog.cpp filterdialog.h
- runsettingswidget.cpp runsettingswidget.h runsettingswidget.ui
+ runsettingswidget.cpp runsettingswidget.h
settingswidget.cpp settingswidget.h
tidychecks.ui
virtualfilesystemoverlay.cpp virtualfilesystemoverlay.h
diff --git a/src/plugins/clangtools/clangtools.qbs b/src/plugins/clangtools/clangtools.qbs
index 4c2a482316..59a9088904 100644
--- a/src/plugins/clangtools/clangtools.qbs
+++ b/src/plugins/clangtools/clangtools.qbs
@@ -71,7 +71,6 @@ QtcPlugin {
"filterdialog.h",
"runsettingswidget.cpp",
"runsettingswidget.h",
- "runsettingswidget.ui",
"settingswidget.cpp",
"settingswidget.h",
"tidychecks.ui",
diff --git a/src/plugins/clangtools/runsettingswidget.cpp b/src/plugins/clangtools/runsettingswidget.cpp
index 4edd5456cf..4f46c4bb66 100644
--- a/src/plugins/clangtools/runsettingswidget.cpp
+++ b/src/plugins/clangtools/runsettingswidget.cpp
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "runsettingswidget.h"
-#include "ui_runsettingswidget.h"
#include "clangtoolssettings.h"
#include "clangtoolsutils.h"
@@ -11,33 +10,58 @@
#include "settingswidget.h"
#include <cppeditor/clangdiagnosticconfigswidget.h>
+#include <cppeditor/clangdiagnosticconfigsselectionwidget.h>
+#include <utils/layoutbuilder.h>
+
+#include <QApplication>
+#include <QCheckBox>
+#include <QSpinBox>
#include <QThread>
using namespace Utils;
-namespace ClangTools {
-namespace Internal {
+namespace ClangTools::Internal {
RunSettingsWidget::RunSettingsWidget(QWidget *parent)
: QWidget(parent)
- , m_ui(new Ui::RunSettingsWidget)
{
- m_ui->setupUi(this);
-}
+ resize(383, 125);
-RunSettingsWidget::~RunSettingsWidget()
-{
- delete m_ui;
+ 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() = default;
+
CppEditor::ClangDiagnosticConfigsSelectionWidget *RunSettingsWidget::diagnosticSelectionWidget()
{
- return m_ui->diagnosticWidget;
+ return m_diagnosticWidget;
}
static CppEditor::ClangDiagnosticConfigsWidget *createEditWidget(
- const CppEditor::ClangDiagnosticConfigs &configs, const Utils::Id &configToSelect)
+ const CppEditor::ClangDiagnosticConfigs &configs, const Id &configToSelect)
{
// Determine executable paths
FilePath clangTidyPath;
@@ -65,44 +89,43 @@ static CppEditor::ClangDiagnosticConfigsWidget *createEditWidget(
void RunSettingsWidget::fromSettings(const RunSettings &s)
{
- disconnect(m_ui->diagnosticWidget, 0, 0, 0);
- m_ui->diagnosticWidget->refresh(diagnosticConfigsModel(),
- s.diagnosticConfigId(),
- createEditWidget);
- connect(m_ui->diagnosticWidget,
+ disconnect(m_diagnosticWidget, 0, 0, 0);
+ m_diagnosticWidget->refresh(diagnosticConfigsModel(),
+ s.diagnosticConfigId(),
+ createEditWidget);
+ connect(m_diagnosticWidget,
&CppEditor::ClangDiagnosticConfigsSelectionWidget::changed,
this,
&RunSettingsWidget::changed);
- disconnect(m_ui->buildBeforeAnalysis, 0, 0, 0);
- m_ui->buildBeforeAnalysis->setToolTip(hintAboutBuildBeforeAnalysis());
- m_ui->buildBeforeAnalysis->setCheckState(s.buildBeforeAnalysis() ? Qt::Checked : Qt::Unchecked);
- connect(m_ui->buildBeforeAnalysis, &QCheckBox::toggled, [this](bool checked) {
+ disconnect(m_buildBeforeAnalysis, 0, 0, 0);
+ m_buildBeforeAnalysis->setToolTip(hintAboutBuildBeforeAnalysis());
+ m_buildBeforeAnalysis->setCheckState(s.buildBeforeAnalysis() ? Qt::Checked : Qt::Unchecked);
+ connect(m_buildBeforeAnalysis, &QCheckBox::toggled, [this](bool checked) {
if (!checked)
showHintAboutBuildBeforeAnalysis();
emit changed();
});
- disconnect(m_ui->parallelJobsSpinBox, 0, 0, 0);
- m_ui->parallelJobsSpinBox->setValue(s.parallelJobs());
- m_ui->parallelJobsSpinBox->setMinimum(1);
- m_ui->parallelJobsSpinBox->setMaximum(QThread::idealThreadCount());
- connect(m_ui->parallelJobsSpinBox, &QSpinBox::valueChanged, this, &RunSettingsWidget::changed);
- m_ui->analyzeOpenFiles->setChecked(s.analyzeOpenFiles());
- connect(m_ui->analyzeOpenFiles, &QCheckBox::toggled, this, &RunSettingsWidget::changed);
+ disconnect(m_parallelJobsSpinBox, 0, 0, 0);
+ m_parallelJobsSpinBox->setValue(s.parallelJobs());
+ m_parallelJobsSpinBox->setMinimum(1);
+ m_parallelJobsSpinBox->setMaximum(QThread::idealThreadCount());
+ connect(m_parallelJobsSpinBox, &QSpinBox::valueChanged, this, &RunSettingsWidget::changed);
+ m_analyzeOpenFiles->setChecked(s.analyzeOpenFiles());
+ connect(m_analyzeOpenFiles, &QCheckBox::toggled, this, &RunSettingsWidget::changed);
}
RunSettings RunSettingsWidget::toSettings() const
{
RunSettings s;
- s.setDiagnosticConfigId(m_ui->diagnosticWidget->currentConfigId());
- s.setBuildBeforeAnalysis(m_ui->buildBeforeAnalysis->checkState() == Qt::CheckState::Checked);
- s.setParallelJobs(m_ui->parallelJobsSpinBox->value());
- s.setAnalyzeOpenFiles(m_ui->analyzeOpenFiles->checkState() == Qt::CheckState::Checked);
+ s.setDiagnosticConfigId(m_diagnosticWidget->currentConfigId());
+ s.setBuildBeforeAnalysis(m_buildBeforeAnalysis->checkState() == Qt::CheckState::Checked);
+ s.setParallelJobs(m_parallelJobsSpinBox->value());
+ s.setAnalyzeOpenFiles(m_analyzeOpenFiles->checkState() == Qt::CheckState::Checked);
return s;
}
-} // namespace Internal
-} // namespace ClangTools
+} // ClangTools::Internal
diff --git a/src/plugins/clangtools/runsettingswidget.h b/src/plugins/clangtools/runsettingswidget.h
index 8a42a32793..4cca522ba8 100644
--- a/src/plugins/clangtools/runsettingswidget.h
+++ b/src/plugins/clangtools/runsettingswidget.h
@@ -7,18 +7,17 @@
#include <QWidget>
-namespace CppEditor {
-class ClangDiagnosticConfigsSelectionWidget;
-}
+QT_BEGIN_NAMESPACE
+class QCheckBox;
+class QSpinBox;
+QT_END_NAMESPACE
-namespace ClangTools {
-namespace Internal {
-class RunSettings;
+namespace CppEditor { class ClangDiagnosticConfigsSelectionWidget; }
+
+namespace ClangTools::Internal {
-namespace Ui {
-class RunSettingsWidget;
-}
+class RunSettings;
class RunSettingsWidget : public QWidget
{
@@ -37,8 +36,10 @@ signals:
void changed();
private:
- Ui::RunSettingsWidget *m_ui;
+ CppEditor::ClangDiagnosticConfigsSelectionWidget *m_diagnosticWidget;
+ QCheckBox *m_buildBeforeAnalysis;
+ QCheckBox *m_analyzeOpenFiles;
+ QSpinBox *m_parallelJobsSpinBox;
};
-} // namespace Internal
-} // namespace ClangTools
+} // ClangTools::Internal
diff --git a/src/plugins/clangtools/runsettingswidget.ui b/src/plugins/clangtools/runsettingswidget.ui
deleted file mode 100644
index d608d9ab2d..0000000000
--- a/src/plugins/clangtools/runsettingswidget.ui
+++ /dev/null
@@ -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>