2016-02-22 17:18:18 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "clangdiagnosticconfigswidget.h"
|
2018-05-04 15:58:41 +02:00
|
|
|
|
|
|
|
|
#include "cppcodemodelsettings.h"
|
2016-02-22 17:18:18 +01:00
|
|
|
#include "ui_clangdiagnosticconfigswidget.h"
|
2018-02-06 13:17:36 +01:00
|
|
|
#include "ui_clangbasechecks.h"
|
2016-02-22 17:18:18 +01:00
|
|
|
|
2019-01-31 10:16:28 +01:00
|
|
|
#include <utils/executeondestruction.h>
|
2020-06-17 06:35:31 +02:00
|
|
|
#include <utils/stringutils.h>
|
2019-10-01 16:53:01 +02:00
|
|
|
#include <utils/treemodel.h>
|
2016-02-22 17:18:18 +01:00
|
|
|
|
|
|
|
|
#include <QInputDialog>
|
2018-05-04 15:58:41 +02:00
|
|
|
#include <QPushButton>
|
2019-02-07 10:09:21 +01:00
|
|
|
|
2016-02-22 17:18:18 +01:00
|
|
|
namespace CppTools {
|
|
|
|
|
|
2019-10-01 16:53:01 +02:00
|
|
|
class ConfigNode : public Utils::TreeItem
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ConfigNode(const ClangDiagnosticConfig &config)
|
|
|
|
|
: config(config)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
QVariant data(int, int role) const override
|
|
|
|
|
{
|
|
|
|
|
if (role == Qt::DisplayRole)
|
|
|
|
|
return config.displayName();
|
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ClangDiagnosticConfig config;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class GroupNode : public Utils::StaticTreeItem
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
GroupNode(const QString &text)
|
|
|
|
|
: Utils::StaticTreeItem(text)
|
|
|
|
|
{}
|
|
|
|
|
|
2020-01-21 13:53:15 +01:00
|
|
|
Qt::ItemFlags flags(int) const { return {}; }
|
2019-10-01 16:53:01 +02:00
|
|
|
QVariant data(int column, int role) const
|
|
|
|
|
{
|
|
|
|
|
if (role == Qt::ForegroundRole) {
|
|
|
|
|
// Avoid disabled color.
|
|
|
|
|
return QApplication::palette().color(QPalette::ColorGroup::Normal,
|
|
|
|
|
QPalette::ColorRole::Text);
|
|
|
|
|
}
|
|
|
|
|
return Utils::StaticTreeItem::data(column, role);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ConfigsModel : public Utils::TreeModel<Utils::TreeItem, GroupNode, ConfigNode>
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ConfigsModel(const ClangDiagnosticConfigs &configs)
|
|
|
|
|
{
|
|
|
|
|
m_builtinRoot = new GroupNode(tr("Built-in"));
|
|
|
|
|
m_customRoot = new GroupNode(tr("Custom"));
|
|
|
|
|
rootItem()->appendChild(m_builtinRoot);
|
|
|
|
|
rootItem()->appendChild(m_customRoot);
|
|
|
|
|
|
|
|
|
|
for (const ClangDiagnosticConfig &config : configs) {
|
|
|
|
|
Utils::TreeItem *parent = config.isReadOnly() ? m_builtinRoot : m_customRoot;
|
|
|
|
|
parent->appendChild(new ConfigNode(config));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int customConfigsCount() const { return m_customRoot->childCount(); }
|
|
|
|
|
QModelIndex fallbackConfigIndex() const { return m_builtinRoot->lastChild()->index(); }
|
|
|
|
|
|
|
|
|
|
ClangDiagnosticConfigs configs() const
|
|
|
|
|
{
|
|
|
|
|
ClangDiagnosticConfigs configs;
|
|
|
|
|
forItemsAtLevel<2>([&configs](const ConfigNode *node) {
|
|
|
|
|
configs << node->config;
|
|
|
|
|
});
|
|
|
|
|
return configs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void appendCustomConfig(const ClangDiagnosticConfig &config)
|
|
|
|
|
{
|
|
|
|
|
m_customRoot->appendChild(new ConfigNode(config));
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
void removeConfig(const Utils::Id &id)
|
2019-10-01 16:53:01 +02:00
|
|
|
{
|
|
|
|
|
ConfigNode *node = itemForConfigId(id);
|
|
|
|
|
node->parent()->removeChildAt(node->indexInParent());
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
ConfigNode *itemForConfigId(const Utils::Id &id) const
|
2019-10-01 16:53:01 +02:00
|
|
|
{
|
|
|
|
|
return findItemAtLevel<2>([id](const ConfigNode *node) {
|
|
|
|
|
return node->config.id() == id;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Utils::TreeItem *m_builtinRoot = nullptr;
|
|
|
|
|
Utils::TreeItem *m_customRoot = nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ClangDiagnosticConfigsWidget::ClangDiagnosticConfigsWidget(const ClangDiagnosticConfigs &configs,
|
2020-06-26 13:59:38 +02:00
|
|
|
const Utils::Id &configToSelect,
|
2019-10-01 16:53:01 +02:00
|
|
|
QWidget *parent)
|
2016-02-22 17:18:18 +01:00
|
|
|
: QWidget(parent)
|
|
|
|
|
, m_ui(new Ui::ClangDiagnosticConfigsWidget)
|
2019-10-01 16:53:01 +02:00
|
|
|
, m_configsModel(new ConfigsModel(configs))
|
2016-02-22 17:18:18 +01:00
|
|
|
{
|
|
|
|
|
m_ui->setupUi(this);
|
2019-10-01 16:53:01 +02:00
|
|
|
m_ui->configsView->setHeaderHidden(true);
|
|
|
|
|
m_ui->configsView->setUniformRowHeights(true);
|
|
|
|
|
m_ui->configsView->setRootIsDecorated(false);
|
|
|
|
|
m_ui->configsView->setModel(m_configsModel);
|
|
|
|
|
m_ui->configsView->setCurrentIndex(m_configsModel->itemForConfigId(configToSelect)->index());
|
|
|
|
|
m_ui->configsView->setItemsExpandable(false);
|
|
|
|
|
m_ui->configsView->expandAll();
|
|
|
|
|
connect(m_ui->configsView->selectionModel(),
|
|
|
|
|
&QItemSelectionModel::currentChanged,
|
|
|
|
|
this,
|
2019-10-21 14:59:57 +02:00
|
|
|
&ClangDiagnosticConfigsWidget::sync);
|
|
|
|
|
|
|
|
|
|
m_clangBaseChecks = std::make_unique<CppTools::Ui::ClangBaseChecks>();
|
|
|
|
|
m_clangBaseChecksWidget = new QWidget();
|
|
|
|
|
m_clangBaseChecks->setupUi(m_clangBaseChecksWidget);
|
2019-10-01 16:53:01 +02:00
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
m_ui->tabWidget->addTab(m_clangBaseChecksWidget, tr("Clang Warnings"));
|
|
|
|
|
m_ui->tabWidget->setCurrentIndex(0);
|
2018-05-04 15:58:41 +02:00
|
|
|
|
2016-02-22 17:18:18 +01:00
|
|
|
connect(m_ui->copyButton, &QPushButton::clicked,
|
|
|
|
|
this, &ClangDiagnosticConfigsWidget::onCopyButtonClicked);
|
2019-10-01 16:53:01 +02:00
|
|
|
connect(m_ui->renameButton, &QPushButton::clicked,
|
|
|
|
|
this, &ClangDiagnosticConfigsWidget::onRenameButtonClicked);
|
2016-02-22 17:18:18 +01:00
|
|
|
connect(m_ui->removeButton, &QPushButton::clicked,
|
|
|
|
|
this, &ClangDiagnosticConfigsWidget::onRemoveButtonClicked);
|
2019-01-31 10:16:28 +01:00
|
|
|
connectClangOnlyOptionsChanged();
|
2016-02-22 17:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ClangDiagnosticConfigsWidget::~ClangDiagnosticConfigsWidget()
|
|
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClangDiagnosticConfigsWidget::onCopyButtonClicked()
|
|
|
|
|
{
|
2019-10-01 16:53:01 +02:00
|
|
|
const ClangDiagnosticConfig &config = currentConfig();
|
|
|
|
|
bool dialogAccepted = false;
|
2016-02-22 17:18:18 +01:00
|
|
|
const QString newName = QInputDialog::getText(this,
|
|
|
|
|
tr("Copy Diagnostic Configuration"),
|
|
|
|
|
tr("Diagnostic configuration name:"),
|
|
|
|
|
QLineEdit::Normal,
|
|
|
|
|
tr("%1 (Copy)").arg(config.displayName()),
|
2019-10-01 16:53:01 +02:00
|
|
|
&dialogAccepted);
|
|
|
|
|
if (dialogAccepted) {
|
2019-01-29 16:03:38 +01:00
|
|
|
const ClangDiagnosticConfig customConfig
|
|
|
|
|
= ClangDiagnosticConfigsModel::createCustomConfig(config, newName);
|
2019-10-21 14:59:57 +02:00
|
|
|
|
2019-10-01 16:53:01 +02:00
|
|
|
m_configsModel->appendCustomConfig(customConfig);
|
2019-10-21 14:59:57 +02:00
|
|
|
m_ui->configsView->setCurrentIndex(
|
|
|
|
|
m_configsModel->itemForConfigId(customConfig.id())->index());
|
|
|
|
|
sync();
|
2018-02-06 13:17:36 +01:00
|
|
|
m_clangBaseChecks->diagnosticOptionsTextEdit->setFocus();
|
2016-02-22 17:18:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-01 16:53:01 +02:00
|
|
|
void ClangDiagnosticConfigsWidget::onRenameButtonClicked()
|
2018-05-04 15:58:41 +02:00
|
|
|
{
|
2019-10-01 16:53:01 +02:00
|
|
|
const ClangDiagnosticConfig &config = currentConfig();
|
|
|
|
|
|
|
|
|
|
bool dialogAccepted = false;
|
|
|
|
|
const QString newName = QInputDialog::getText(this,
|
|
|
|
|
tr("Rename Diagnostic Configuration"),
|
2020-03-11 11:59:46 +01:00
|
|
|
tr("New name:"),
|
2019-10-01 16:53:01 +02:00
|
|
|
QLineEdit::Normal,
|
|
|
|
|
config.displayName(),
|
|
|
|
|
&dialogAccepted);
|
|
|
|
|
if (dialogAccepted) {
|
|
|
|
|
ConfigNode *configNode = m_configsModel->itemForConfigId(config.id());
|
|
|
|
|
configNode->config.setDisplayName(newName);
|
|
|
|
|
}
|
2018-05-04 15:58:41 +02:00
|
|
|
}
|
|
|
|
|
|
2019-10-01 16:53:01 +02:00
|
|
|
const ClangDiagnosticConfig ClangDiagnosticConfigsWidget::currentConfig() const
|
2018-05-04 15:58:41 +02:00
|
|
|
{
|
2019-10-01 16:53:01 +02:00
|
|
|
Utils::TreeItem *item = m_configsModel->itemForIndex(m_ui->configsView->currentIndex());
|
|
|
|
|
return static_cast<ConfigNode *>(item)->config;
|
2018-05-04 15:58:41 +02:00
|
|
|
}
|
|
|
|
|
|
2016-02-22 17:18:18 +01:00
|
|
|
void ClangDiagnosticConfigsWidget::onRemoveButtonClicked()
|
|
|
|
|
{
|
2020-06-26 13:59:38 +02:00
|
|
|
const Utils::Id configToRemove = currentConfig().id();
|
2019-10-01 16:53:01 +02:00
|
|
|
if (m_configsModel->customConfigsCount() == 1)
|
|
|
|
|
m_ui->configsView->setCurrentIndex(m_configsModel->fallbackConfigIndex());
|
|
|
|
|
m_configsModel->removeConfig(configToRemove);
|
2019-10-21 14:59:57 +02:00
|
|
|
sync();
|
2018-02-07 09:20:30 +01:00
|
|
|
}
|
|
|
|
|
|
2017-09-08 13:00:44 +02:00
|
|
|
static bool isAcceptedWarningOption(const QString &option)
|
|
|
|
|
{
|
|
|
|
|
return option == "-w"
|
|
|
|
|
|| option == "-pedantic"
|
|
|
|
|
|| option == "-pedantic-errors";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reference:
|
|
|
|
|
// https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
|
|
|
|
// https://clang.llvm.org/docs/DiagnosticsReference.html
|
|
|
|
|
static bool isValidOption(const QString &option)
|
|
|
|
|
{
|
|
|
|
|
if (option == "-Werror")
|
|
|
|
|
return false; // Avoid errors due to unknown or misspelled warnings.
|
|
|
|
|
return option.startsWith("-W") || isAcceptedWarningOption(option);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static QString validateDiagnosticOptions(const QStringList &options)
|
|
|
|
|
{
|
|
|
|
|
// This is handy for testing, allow disabling validation.
|
|
|
|
|
if (qEnvironmentVariableIntValue("QTC_CLANG_NO_DIAGNOSTIC_CHECK"))
|
|
|
|
|
return QString();
|
|
|
|
|
|
|
|
|
|
for (const QString &option : options) {
|
|
|
|
|
if (!isValidOption(option))
|
|
|
|
|
return ClangDiagnosticConfigsWidget::tr("Option \"%1\" is invalid.").arg(option);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static QStringList normalizeDiagnosticInputOptions(const QString &options)
|
|
|
|
|
{
|
2020-07-21 10:19:36 +02:00
|
|
|
return options.simplified().split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
2017-09-08 13:00:44 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-31 10:16:28 +01:00
|
|
|
void ClangDiagnosticConfigsWidget::onClangOnlyOptionsChanged()
|
2016-02-22 17:18:18 +01:00
|
|
|
{
|
2019-01-31 10:16:28 +01:00
|
|
|
const bool useBuildSystemWarnings = m_clangBaseChecks->useFlagsFromBuildSystemCheckBox
|
|
|
|
|
->isChecked();
|
|
|
|
|
|
|
|
|
|
// Clean up options input
|
2018-02-06 13:17:36 +01:00
|
|
|
const QString diagnosticOptions = m_clangBaseChecks->diagnosticOptionsTextEdit->document()
|
|
|
|
|
->toPlainText();
|
2017-09-08 13:00:44 +02:00
|
|
|
const QStringList normalizedOptions = normalizeDiagnosticInputOptions(diagnosticOptions);
|
|
|
|
|
|
2019-01-31 10:16:28 +01:00
|
|
|
// Validate options input
|
2017-09-08 13:00:44 +02:00
|
|
|
const QString errorMessage = validateDiagnosticOptions(normalizedOptions);
|
|
|
|
|
updateValidityWidgets(errorMessage);
|
|
|
|
|
if (!errorMessage.isEmpty()) {
|
|
|
|
|
// Remember the entered options in case the user will switch back.
|
2019-10-01 16:53:01 +02:00
|
|
|
m_notAcceptedOptions.insert(currentConfig().id(), diagnosticOptions);
|
2017-09-08 13:00:44 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2019-10-01 16:53:01 +02:00
|
|
|
m_notAcceptedOptions.remove(currentConfig().id());
|
2016-02-22 17:18:18 +01:00
|
|
|
|
2017-09-08 13:00:44 +02:00
|
|
|
// Commit valid changes
|
2019-10-01 16:53:01 +02:00
|
|
|
ClangDiagnosticConfig updatedConfig = currentConfig();
|
2018-01-26 10:27:58 +01:00
|
|
|
updatedConfig.setClangOptions(normalizedOptions);
|
2019-01-31 10:16:28 +01:00
|
|
|
updatedConfig.setUseBuildSystemWarnings(useBuildSystemWarnings);
|
2018-01-26 10:27:58 +01:00
|
|
|
updateConfig(updatedConfig);
|
2016-02-22 17:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
void ClangDiagnosticConfigsWidget::sync()
|
2016-02-22 17:18:18 +01:00
|
|
|
{
|
2019-10-01 16:53:01 +02:00
|
|
|
if (!m_ui->configsView->currentIndex().isValid())
|
2016-02-22 17:18:18 +01:00
|
|
|
return;
|
|
|
|
|
|
2019-01-31 10:16:28 +01:00
|
|
|
disconnectClangOnlyOptionsChanged();
|
|
|
|
|
Utils::ExecuteOnDestruction e([this]() { connectClangOnlyOptionsChanged(); });
|
|
|
|
|
|
2016-02-22 17:18:18 +01:00
|
|
|
// Update main button row
|
2019-10-01 16:53:01 +02:00
|
|
|
const ClangDiagnosticConfig &config = currentConfig();
|
2016-02-22 17:18:18 +01:00
|
|
|
m_ui->removeButton->setEnabled(!config.isReadOnly());
|
2019-10-01 16:53:01 +02:00
|
|
|
m_ui->renameButton->setEnabled(!config.isReadOnly());
|
2016-02-22 17:18:18 +01:00
|
|
|
|
2019-01-31 10:16:28 +01:00
|
|
|
// Update check box
|
|
|
|
|
m_clangBaseChecks->useFlagsFromBuildSystemCheckBox->setChecked(config.useBuildSystemWarnings());
|
|
|
|
|
|
2018-01-26 10:27:58 +01:00
|
|
|
// Update Text Edit
|
2017-09-08 13:00:44 +02:00
|
|
|
const QString options = m_notAcceptedOptions.contains(config.id())
|
|
|
|
|
? m_notAcceptedOptions.value(config.id())
|
2018-01-26 10:27:58 +01:00
|
|
|
: config.clangOptions().join(QLatin1Char(' '));
|
2017-09-08 13:00:44 +02:00
|
|
|
setDiagnosticOptions(options);
|
2018-02-12 12:04:08 +01:00
|
|
|
m_clangBaseChecksWidget->setEnabled(!config.isReadOnly());
|
2018-01-26 10:27:58 +01:00
|
|
|
|
2018-02-12 11:34:38 +01:00
|
|
|
if (config.isReadOnly()) {
|
2019-12-20 09:08:57 +01:00
|
|
|
m_ui->infoLabel->setType(Utils::InfoLabel::Information);
|
2018-02-12 11:34:38 +01:00
|
|
|
m_ui->infoLabel->setText(tr("Copy this configuration to customize it."));
|
2019-12-20 09:08:57 +01:00
|
|
|
m_ui->infoLabel->setFilled(false);
|
2018-02-12 11:34:38 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
syncExtraWidgets(config);
|
2018-01-26 10:27:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClangDiagnosticConfigsWidget::updateConfig(const ClangDiagnosticConfig &config)
|
|
|
|
|
{
|
2019-10-01 16:53:01 +02:00
|
|
|
m_configsModel->itemForConfigId(config.id())->config = config;
|
2016-02-22 17:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
2016-02-26 17:50:38 +01:00
|
|
|
void ClangDiagnosticConfigsWidget::setDiagnosticOptions(const QString &options)
|
|
|
|
|
{
|
2019-01-31 10:16:28 +01:00
|
|
|
if (options != m_clangBaseChecks->diagnosticOptionsTextEdit->document()->toPlainText())
|
2018-02-06 13:17:36 +01:00
|
|
|
m_clangBaseChecks->diagnosticOptionsTextEdit->document()->setPlainText(options);
|
2018-02-12 11:34:38 +01:00
|
|
|
|
|
|
|
|
const QString errorMessage
|
|
|
|
|
= validateDiagnosticOptions(normalizeDiagnosticInputOptions(options));
|
|
|
|
|
updateValidityWidgets(errorMessage);
|
2016-02-26 17:50:38 +01:00
|
|
|
}
|
|
|
|
|
|
2017-09-08 13:00:44 +02:00
|
|
|
void ClangDiagnosticConfigsWidget::updateValidityWidgets(const QString &errorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (errorMessage.isEmpty()) {
|
2019-12-20 09:08:57 +01:00
|
|
|
m_ui->infoLabel->setType(Utils::InfoLabel::Information);
|
|
|
|
|
m_ui->infoLabel->setText(tr("Configuration passes sanity checks."));
|
|
|
|
|
m_ui->infoLabel->setFilled(false);
|
2017-09-08 13:00:44 +02:00
|
|
|
} else {
|
2019-12-20 09:08:57 +01:00
|
|
|
m_ui->infoLabel->setType(Utils::InfoLabel::Error);
|
|
|
|
|
m_ui->infoLabel->setText(tr("%1").arg(errorMessage));
|
|
|
|
|
m_ui->infoLabel->setFilled(true);
|
2017-09-08 13:00:44 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-31 10:16:28 +01:00
|
|
|
void ClangDiagnosticConfigsWidget::connectClangOnlyOptionsChanged()
|
2016-02-26 17:50:38 +01:00
|
|
|
{
|
2019-01-31 10:16:28 +01:00
|
|
|
connect(m_clangBaseChecks->useFlagsFromBuildSystemCheckBox,
|
|
|
|
|
&QCheckBox::stateChanged,
|
|
|
|
|
this,
|
|
|
|
|
&ClangDiagnosticConfigsWidget::onClangOnlyOptionsChanged);
|
2018-02-06 13:17:36 +01:00
|
|
|
connect(m_clangBaseChecks->diagnosticOptionsTextEdit->document(),
|
|
|
|
|
&QTextDocument::contentsChanged,
|
|
|
|
|
this,
|
2019-01-31 10:16:28 +01:00
|
|
|
&ClangDiagnosticConfigsWidget::onClangOnlyOptionsChanged);
|
2016-02-26 17:50:38 +01:00
|
|
|
}
|
|
|
|
|
|
2019-01-31 10:16:28 +01:00
|
|
|
void ClangDiagnosticConfigsWidget::disconnectClangOnlyOptionsChanged()
|
2016-02-26 17:50:38 +01:00
|
|
|
{
|
2019-01-31 10:16:28 +01:00
|
|
|
disconnect(m_clangBaseChecks->useFlagsFromBuildSystemCheckBox,
|
|
|
|
|
&QCheckBox::stateChanged,
|
|
|
|
|
this,
|
|
|
|
|
&ClangDiagnosticConfigsWidget::onClangOnlyOptionsChanged);
|
2018-02-06 13:17:36 +01:00
|
|
|
disconnect(m_clangBaseChecks->diagnosticOptionsTextEdit->document(),
|
|
|
|
|
&QTextDocument::contentsChanged,
|
|
|
|
|
this,
|
2019-01-31 10:16:28 +01:00
|
|
|
&ClangDiagnosticConfigsWidget::onClangOnlyOptionsChanged);
|
2016-02-26 17:50:38 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-01 16:53:01 +02:00
|
|
|
ClangDiagnosticConfigs ClangDiagnosticConfigsWidget::configs() const
|
2016-02-22 17:18:18 +01:00
|
|
|
{
|
2019-10-01 16:53:01 +02:00
|
|
|
return m_configsModel->configs();
|
2016-02-22 17:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
QTabWidget *ClangDiagnosticConfigsWidget::tabWidget() const
|
2018-01-26 10:27:58 +01:00
|
|
|
{
|
2019-10-21 14:59:57 +02:00
|
|
|
return m_ui->tabWidget;
|
2018-01-26 10:27:58 +01:00
|
|
|
}
|
|
|
|
|
|
2016-02-22 17:18:18 +01:00
|
|
|
} // CppTools namespace
|
2018-05-16 07:58:53 +02:00
|
|
|
|
|
|
|
|
#include "clangdiagnosticconfigswidget.moc"
|