2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2015-12-06 15:33:13 +03:00
|
|
|
#include "WarningMessagesDialog.h"
|
|
|
|
|
|
|
|
WarningMessagesDialog::WarningMessagesDialog(QWidget* prnt, QCMake* instance)
|
2016-05-16 17:34:04 +03:00
|
|
|
: QDialog(prnt)
|
|
|
|
, cmakeInstance(instance)
|
2015-12-06 15:33:13 +03:00
|
|
|
{
|
|
|
|
this->setupUi(this);
|
|
|
|
this->setInitialValues();
|
|
|
|
this->setupSignals();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WarningMessagesDialog::setInitialValues()
|
|
|
|
{
|
|
|
|
this->suppressDeveloperWarnings->setChecked(
|
|
|
|
this->cmakeInstance->getSuppressDevWarnings());
|
|
|
|
this->suppressDeprecatedWarnings->setChecked(
|
|
|
|
this->cmakeInstance->getSuppressDeprecatedWarnings());
|
2015-12-26 19:04:13 +03:00
|
|
|
|
|
|
|
this->developerWarningsAsErrors->setChecked(
|
|
|
|
this->cmakeInstance->getDevWarningsAsErrors());
|
|
|
|
this->deprecatedWarningsAsErrors->setChecked(
|
|
|
|
this->cmakeInstance->getDeprecatedWarningsAsErrors());
|
2015-12-06 15:33:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WarningMessagesDialog::setupSignals()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
QObject::connect(this->buttonBox, SIGNAL(accepted()), this,
|
|
|
|
SLOT(doAccept()));
|
2015-12-26 19:04:13 +03:00
|
|
|
|
|
|
|
QObject::connect(this->suppressDeveloperWarnings, SIGNAL(stateChanged(int)),
|
|
|
|
this, SLOT(doSuppressDeveloperWarningsChanged(int)));
|
|
|
|
QObject::connect(this->suppressDeprecatedWarnings, SIGNAL(stateChanged(int)),
|
|
|
|
this, SLOT(doSuppressDeprecatedWarningsChanged(int)));
|
|
|
|
|
|
|
|
QObject::connect(this->developerWarningsAsErrors, SIGNAL(stateChanged(int)),
|
|
|
|
this, SLOT(doDeveloperWarningsAsErrorsChanged(int)));
|
|
|
|
QObject::connect(this->deprecatedWarningsAsErrors, SIGNAL(stateChanged(int)),
|
|
|
|
this, SLOT(doDeprecatedWarningsAsErrorsChanged(int)));
|
2015-12-06 15:33:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WarningMessagesDialog::doAccept()
|
|
|
|
{
|
|
|
|
this->cmakeInstance->setSuppressDevWarnings(
|
|
|
|
this->suppressDeveloperWarnings->isChecked());
|
|
|
|
this->cmakeInstance->setSuppressDeprecatedWarnings(
|
|
|
|
this->suppressDeprecatedWarnings->isChecked());
|
2015-12-26 19:04:13 +03:00
|
|
|
|
|
|
|
this->cmakeInstance->setDevWarningsAsErrors(
|
|
|
|
this->developerWarningsAsErrors->isChecked());
|
|
|
|
this->cmakeInstance->setDeprecatedWarningsAsErrors(
|
|
|
|
this->deprecatedWarningsAsErrors->isChecked());
|
|
|
|
}
|
|
|
|
|
|
|
|
void WarningMessagesDialog::doSuppressDeveloperWarningsChanged(int state)
|
|
|
|
{
|
|
|
|
// no warnings implies no errors either
|
2016-05-16 17:34:04 +03:00
|
|
|
if (state) {
|
2015-12-26 19:04:13 +03:00
|
|
|
this->developerWarningsAsErrors->setChecked(false);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-12-26 19:04:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(int state)
|
|
|
|
{
|
|
|
|
// no warnings implies no errors either
|
2016-05-16 17:34:04 +03:00
|
|
|
if (state) {
|
2015-12-26 19:04:13 +03:00
|
|
|
this->deprecatedWarningsAsErrors->setChecked(false);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-12-26 19:04:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(int state)
|
|
|
|
{
|
|
|
|
// warnings as errors implies warnings are not suppressed
|
2016-05-16 17:34:04 +03:00
|
|
|
if (state) {
|
2015-12-26 19:04:13 +03:00
|
|
|
this->suppressDeveloperWarnings->setChecked(false);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-12-26 19:04:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged(int state)
|
|
|
|
{
|
|
|
|
// warnings as errors implies warnings are not suppressed
|
2016-05-16 17:34:04 +03:00
|
|
|
if (state) {
|
2015-12-26 19:04:13 +03:00
|
|
|
this->suppressDeprecatedWarnings->setChecked(false);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-12-06 15:33:13 +03:00
|
|
|
}
|