From 821667018cc0ea049c52647b507d1a8e4bbe2c3a Mon Sep 17 00:00:00 2001 From: Michael Scott Date: Sat, 26 Dec 2015 16:04:13 +0000 Subject: cmake-gui: Add options to control warning-as-error messages Add new widgets to the warning messages dialog to control treating warnings as errors. --- Source/QtDialog/QCMake.cxx | 20 +++++++++++ Source/QtDialog/QCMake.h | 8 +++++ Source/QtDialog/WarningMessagesDialog.cxx | 56 ++++++++++++++++++++++++++++++ Source/QtDialog/WarningMessagesDialog.h | 22 ++++++++++++ Source/QtDialog/WarningMessagesDialog.ui | 57 +++++++++++++++++++++++++++++-- 5 files changed, 161 insertions(+), 2 deletions(-) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 71b7940..dd7c138 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -475,6 +475,26 @@ void QCMake::setSuppressDeprecatedWarnings(bool value) this->CMakeInstance->SetSuppressDeprecatedWarnings(value); } +bool QCMake::getDevWarningsAsErrors() +{ + return this->CMakeInstance->GetDevWarningsAsErrors(); +} + +void QCMake::setDevWarningsAsErrors(bool value) +{ + this->CMakeInstance->SetDevWarningsAsErrors(value); +} + +bool QCMake::getDeprecatedWarningsAsErrors() +{ + return this->CMakeInstance->GetDeprecatedWarningsAsErrors(); +} + +void QCMake::setDeprecatedWarningsAsErrors(bool value) +{ + this->CMakeInstance->SetDeprecatedWarningsAsErrors(value); +} + void QCMake::setWarnUninitializedMode(bool value) { this->WarnUninitializedMode = value; diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 4b787b9..8942e7c 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -99,6 +99,14 @@ public slots: bool getSuppressDeprecatedWarnings(); /// set whether to do suppress deprecated warnings void setSuppressDeprecatedWarnings(bool value); + /// get whether to treat developer (author) warnings as errors + bool getDevWarningsAsErrors(); + /// set whether to treat developer (author) warnings as errors + void setDevWarningsAsErrors(bool value); + /// get whether to treat deprecated warnings as errors + bool getDeprecatedWarningsAsErrors(); + /// set whether to treat deprecated warnings as errors + void setDeprecatedWarningsAsErrors(bool value); /// set whether to run cmake with warnings about uninitialized variables void setWarnUninitializedMode(bool value); /// set whether to run cmake with warnings about unused variables diff --git a/Source/QtDialog/WarningMessagesDialog.cxx b/Source/QtDialog/WarningMessagesDialog.cxx index 735b71c..4bd541f 100644 --- a/Source/QtDialog/WarningMessagesDialog.cxx +++ b/Source/QtDialog/WarningMessagesDialog.cxx @@ -26,12 +26,27 @@ void WarningMessagesDialog::setInitialValues() this->cmakeInstance->getSuppressDevWarnings()); this->suppressDeprecatedWarnings->setChecked( this->cmakeInstance->getSuppressDeprecatedWarnings()); + + this->developerWarningsAsErrors->setChecked( + this->cmakeInstance->getDevWarningsAsErrors()); + this->deprecatedWarningsAsErrors->setChecked( + this->cmakeInstance->getDeprecatedWarningsAsErrors()); } void WarningMessagesDialog::setupSignals() { QObject::connect(this->buttonBox, SIGNAL(accepted()), this, SLOT(doAccept())); + + 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() @@ -40,4 +55,45 @@ void WarningMessagesDialog::doAccept() 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 + if (state) + { + this->developerWarningsAsErrors->setChecked(false); + } +} + +void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(int state) +{ + // no warnings implies no errors either + if (state) + { + this->deprecatedWarningsAsErrors->setChecked(false); + } +} + +void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(int state) +{ + // warnings as errors implies warnings are not suppressed + if (state) + { + this->suppressDeveloperWarnings->setChecked(false); + } +} + +void WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged(int state) +{ + // warnings as errors implies warnings are not suppressed + if (state) + { + this->suppressDeprecatedWarnings->setChecked(false); + } } diff --git a/Source/QtDialog/WarningMessagesDialog.h b/Source/QtDialog/WarningMessagesDialog.h index 028ec10..6c274a7 100644 --- a/Source/QtDialog/WarningMessagesDialog.h +++ b/Source/QtDialog/WarningMessagesDialog.h @@ -35,6 +35,28 @@ private slots: */ void doAccept(); + /** + * Handler for checked state changed event of the suppress developer warnings + * checkbox. + */ + void doSuppressDeveloperWarningsChanged(int state); + /** + * Handler for checked state changed event of the suppress deprecated + * warnings checkbox. + */ + void doSuppressDeprecatedWarningsChanged(int state); + + /** + * Handler for checked state changed event of the developer warnings as + * errors checkbox. + */ + void doDeveloperWarningsAsErrorsChanged(int state); + /** + * Handler for checked state changed event of the deprecated warnings as + * errors checkbox. + */ + void doDeprecatedWarningsAsErrorsChanged(int state); + private: QCMake* cmakeInstance; diff --git a/Source/QtDialog/WarningMessagesDialog.ui b/Source/QtDialog/WarningMessagesDialog.ui index 2367772..3b35cbc 100644 --- a/Source/QtDialog/WarningMessagesDialog.ui +++ b/Source/QtDialog/WarningMessagesDialog.ui @@ -6,8 +6,8 @@ 0 0 - 250 - 150 + 300 + 300 @@ -37,6 +37,9 @@ 0 + + Suppress developer (author) warnings. + Developer Warnings @@ -53,6 +56,9 @@ 0 + + Suppress deprecated warnings. + Deprecated Warnings @@ -65,6 +71,53 @@ + + + + 0 + 0 + + + + Warnings as Errors + + + + + + + 0 + 0 + + + + Treat developer (author) warnings as errors. + + + Developer Warnings as Errors + + + + + + + + 0 + 0 + + + + Treat deprecated warnings as errors. + + + Deprecated Warnings as Errors + + + + + + + -- cgit v0.12