mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 23:00:07 -06:00
In commit cbf0d3da52 (cmake-gui: Port away from deprecated API in Qt >=
6.7, 2025-02-21, v4.1.0-rc1~755^2~4) we assumed that `Qt::CheckState` is
implemented as an `int`. Spell out the type explicitly for the Qt 6.7+
callback signatures.
97 lines
3.1 KiB
C++
97 lines
3.1 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file LICENSE.rst or https://cmake.org/licensing for details. */
|
|
#include "WarningMessagesDialog.h"
|
|
|
|
WarningMessagesDialog::WarningMessagesDialog(QWidget* prnt, QCMake* instance)
|
|
: QDialog(prnt)
|
|
, cmakeInstance(instance)
|
|
{
|
|
this->setupUi(this);
|
|
this->setInitialValues();
|
|
this->setupSignals();
|
|
}
|
|
|
|
void WarningMessagesDialog::setInitialValues()
|
|
{
|
|
this->suppressDeveloperWarnings->setChecked(
|
|
this->cmakeInstance->getSuppressDevWarnings());
|
|
this->suppressDeprecatedWarnings->setChecked(
|
|
this->cmakeInstance->getSuppressDeprecatedWarnings());
|
|
|
|
this->developerWarningsAsErrors->setChecked(
|
|
this->cmakeInstance->getDevWarningsAsErrors());
|
|
this->deprecatedWarningsAsErrors->setChecked(
|
|
this->cmakeInstance->getDeprecatedWarningsAsErrors());
|
|
}
|
|
|
|
void WarningMessagesDialog::setupSignals()
|
|
{
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
|
|
static auto const checkStateChanged = &QCheckBox::checkStateChanged;
|
|
#else
|
|
static auto const checkStateChanged = &QCheckBox::stateChanged;
|
|
#endif
|
|
QObject::connect(this->buttonBox, &QDialogButtonBox::accepted, this,
|
|
&WarningMessagesDialog::doAccept);
|
|
QObject::connect(this->suppressDeveloperWarnings, checkStateChanged, this,
|
|
&WarningMessagesDialog::doSuppressDeveloperWarningsChanged);
|
|
QObject::connect(
|
|
this->suppressDeprecatedWarnings, checkStateChanged, this,
|
|
&WarningMessagesDialog::doSuppressDeprecatedWarningsChanged);
|
|
|
|
QObject::connect(this->developerWarningsAsErrors, checkStateChanged, this,
|
|
&WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged);
|
|
QObject::connect(
|
|
this->deprecatedWarningsAsErrors, checkStateChanged, this,
|
|
&WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged);
|
|
}
|
|
|
|
void WarningMessagesDialog::doAccept()
|
|
{
|
|
this->cmakeInstance->setSuppressDevWarnings(
|
|
this->suppressDeveloperWarnings->isChecked());
|
|
this->cmakeInstance->setSuppressDeprecatedWarnings(
|
|
this->suppressDeprecatedWarnings->isChecked());
|
|
|
|
this->cmakeInstance->setDevWarningsAsErrors(
|
|
this->developerWarningsAsErrors->isChecked());
|
|
this->cmakeInstance->setDeprecatedWarningsAsErrors(
|
|
this->deprecatedWarningsAsErrors->isChecked());
|
|
}
|
|
|
|
void WarningMessagesDialog::doSuppressDeveloperWarningsChanged(
|
|
CheckState state)
|
|
{
|
|
// no warnings implies no errors either
|
|
if (state) {
|
|
this->developerWarningsAsErrors->setChecked(false);
|
|
}
|
|
}
|
|
|
|
void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(
|
|
CheckState state)
|
|
{
|
|
// no warnings implies no errors either
|
|
if (state) {
|
|
this->deprecatedWarningsAsErrors->setChecked(false);
|
|
}
|
|
}
|
|
|
|
void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(
|
|
CheckState state)
|
|
{
|
|
// warnings as errors implies warnings are not suppressed
|
|
if (state) {
|
|
this->suppressDeveloperWarnings->setChecked(false);
|
|
}
|
|
}
|
|
|
|
void WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged(
|
|
CheckState state)
|
|
{
|
|
// warnings as errors implies warnings are not suppressed
|
|
if (state) {
|
|
this->suppressDeprecatedWarnings->setChecked(false);
|
|
}
|
|
}
|