cmake-gui: Add options to control warning-as-error messages

Add new widgets to the warning messages dialog to control treating
warnings as errors.
This commit is contained in:
Michael Scott 2015-12-26 16:04:13 +00:00 committed by Brad King
parent 28f2d750ed
commit 821667018c
5 changed files with 161 additions and 2 deletions

View File

@ -475,6 +475,26 @@ void QCMake::setSuppressDeprecatedWarnings(bool value)
this->CMakeInstance->SetSuppressDeprecatedWarnings(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) void QCMake::setWarnUninitializedMode(bool value)
{ {
this->WarnUninitializedMode = value; this->WarnUninitializedMode = value;

View File

@ -99,6 +99,14 @@ public slots:
bool getSuppressDeprecatedWarnings(); bool getSuppressDeprecatedWarnings();
/// set whether to do suppress deprecated warnings /// set whether to do suppress deprecated warnings
void setSuppressDeprecatedWarnings(bool value); 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 /// set whether to run cmake with warnings about uninitialized variables
void setWarnUninitializedMode(bool value); void setWarnUninitializedMode(bool value);
/// set whether to run cmake with warnings about unused variables /// set whether to run cmake with warnings about unused variables

View File

@ -26,12 +26,27 @@ void WarningMessagesDialog::setInitialValues()
this->cmakeInstance->getSuppressDevWarnings()); this->cmakeInstance->getSuppressDevWarnings());
this->suppressDeprecatedWarnings->setChecked( this->suppressDeprecatedWarnings->setChecked(
this->cmakeInstance->getSuppressDeprecatedWarnings()); this->cmakeInstance->getSuppressDeprecatedWarnings());
this->developerWarningsAsErrors->setChecked(
this->cmakeInstance->getDevWarningsAsErrors());
this->deprecatedWarningsAsErrors->setChecked(
this->cmakeInstance->getDeprecatedWarningsAsErrors());
} }
void WarningMessagesDialog::setupSignals() void WarningMessagesDialog::setupSignals()
{ {
QObject::connect(this->buttonBox, SIGNAL(accepted()), QObject::connect(this->buttonBox, SIGNAL(accepted()),
this, SLOT(doAccept())); 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() void WarningMessagesDialog::doAccept()
@ -40,4 +55,45 @@ void WarningMessagesDialog::doAccept()
this->suppressDeveloperWarnings->isChecked()); this->suppressDeveloperWarnings->isChecked());
this->cmakeInstance->setSuppressDeprecatedWarnings( this->cmakeInstance->setSuppressDeprecatedWarnings(
this->suppressDeprecatedWarnings->isChecked()); 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);
}
} }

View File

@ -35,6 +35,28 @@ private slots:
*/ */
void doAccept(); 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: private:
QCMake* cmakeInstance; QCMake* cmakeInstance;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>250</width> <width>300</width>
<height>150</height> <height>300</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -37,6 +37,9 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Suppress developer (author) warnings.</string>
</property>
<property name="text"> <property name="text">
<string>Developer Warnings</string> <string>Developer Warnings</string>
</property> </property>
@ -53,6 +56,9 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Suppress deprecated warnings.</string>
</property>
<property name="text"> <property name="text">
<string>Deprecated Warnings</string> <string>Deprecated Warnings</string>
</property> </property>
@ -64,6 +70,53 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Warnings as Errors</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="developerWarningsAsErrors">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Treat developer (author) warnings as errors.</string>
</property>
<property name="text">
<string>Developer Warnings as Errors</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="deprecatedWarningsAsErrors">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Treat deprecated warnings as errors.</string>
</property>
<property name="text">
<string>Deprecated Warnings as Errors</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy"> <property name="sizePolicy">