cmake/Source/QtDialog/WarningMessagesDialog.cxx

87 lines
2.8 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()
{
2016-07-09 11:21:54 +02:00
QObject::connect(this->buttonBox, SIGNAL(accepted()), this,
SLOT(doAccept()));
2016-03-13 13:35:51 +01: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)));
}
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
}