cmake/Source/QtDialog/WarningMessagesDialog.cxx

91 lines
2.9 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2016-03-13 13:35:51 +01:00
#include "WarningMessagesDialog.h"
WarningMessagesDialog::WarningMessagesDialog(QWidget* prnt, QCMake* instance)
2016-07-09 11:21:54 +02:00
: QDialog(prnt)
, cmakeInstance(instance)
2016-03-13 13:35:51 +01:00
{
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()
{
2021-09-14 00:13:48 +02:00
QObject::connect(this->buttonBox, &QDialogButtonBox::accepted, this,
&WarningMessagesDialog::doAccept);
QObject::connect(this->suppressDeveloperWarnings, &QCheckBox::stateChanged,
this,
&WarningMessagesDialog::doSuppressDeveloperWarningsChanged);
QObject::connect(
this->suppressDeprecatedWarnings, &QCheckBox::stateChanged, this,
&WarningMessagesDialog::doSuppressDeprecatedWarningsChanged);
QObject::connect(this->developerWarningsAsErrors, &QCheckBox::stateChanged,
this,
&WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged);
QObject::connect(
this->deprecatedWarningsAsErrors, &QCheckBox::stateChanged, this,
&WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged);
2016-03-13 13:35:51 +01:00
}
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(int state)
{
// no warnings implies no errors either
2016-07-09 11:21:54 +02:00
if (state) {
2016-03-13 13:35:51 +01:00
this->developerWarningsAsErrors->setChecked(false);
2016-07-09 11:21:54 +02:00
}
2016-03-13 13:35:51 +01:00
}
void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(int state)
{
// no warnings implies no errors either
2016-07-09 11:21:54 +02:00
if (state) {
2016-03-13 13:35:51 +01:00
this->deprecatedWarningsAsErrors->setChecked(false);
2016-07-09 11:21:54 +02:00
}
2016-03-13 13:35:51 +01:00
}
void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(int state)
{
// warnings as errors implies warnings are not suppressed
2016-07-09 11:21:54 +02:00
if (state) {
2016-03-13 13:35:51 +01:00
this->suppressDeveloperWarnings->setChecked(false);
2016-07-09 11:21:54 +02:00
}
2016-03-13 13:35:51 +01:00
}
void WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged(int state)
{
// warnings as errors implies warnings are not suppressed
2016-07-09 11:21:54 +02:00
if (state) {
2016-03-13 13:35:51 +01:00
this->suppressDeprecatedWarnings->setChecked(false);
2016-07-09 11:21:54 +02:00
}
2016-03-13 13:35:51 +01:00
}