Skip to content

Commit f2b98ec

Browse files
committed
Remove option CheckBoth
In preparation to add CheckIndentifiers, this mode needs to be retired.
1 parent a56e8b8 commit f2b98ec

File tree

5 files changed

+90
-236
lines changed

5 files changed

+90
-236
lines changed

src/Parsers/CppParser/cppparseroptionswidget.cpp

+8-12
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ CppParserOptionsWidget::CppParserOptionsWidget( const CppParserSettings* const s
3737
ui->labelDescriptionEmail->setText( ui->labelDescriptionEmail->text().arg( QLatin1String( SpellChecker::Parsers::CppParser::Constants::EMAIL_ADDRESS_REGEXP_PATTERN ) ) );
3838
ui->labelDescriptionWebsites->setText( ui->labelDescriptionWebsites->text().arg( QLatin1String( SpellChecker::Parsers::CppParser::Constants::WEBSITE_ADDRESS_REGEXP_PATTERN ) ) );
3939
/* Set up the options for What to Check */
40-
ui->radioButtonWhatComments->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckComments );
41-
ui->radioButtonWhatLiterals->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckStringLiterals );
42-
ui->radioButtonWhatBoth->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckBoth );
43-
connect( ui->radioButtonWhatComments, &QRadioButton::toggled, this, &CppParserOptionsWidget::radioButtonWhatToggled );
44-
connect( ui->radioButtonWhatLiterals, &QRadioButton::toggled, this, &CppParserOptionsWidget::radioButtonWhatToggled );
45-
connect( ui->radioButtonWhatBoth, &QRadioButton::toggled, this, &CppParserOptionsWidget::radioButtonWhatToggled );
40+
ui->checkBoxWhatComments->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckComments );
41+
ui->checkBoxWhatLiterals->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckStringLiterals );
42+
connect( ui->checkBoxWhatComments, &QAbstractButton::toggled, this, &CppParserOptionsWidget::checkBoxWhatToggled );
43+
connect( ui->checkBoxWhatLiterals, &QAbstractButton::toggled, this, &CppParserOptionsWidget::checkBoxWhatToggled );
4644
/* Set up the options for Comments to Check */
4745
ui->radioButtonCommentsC->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CommentsC );
4846
ui->radioButtonCommentsCpp->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CommentsCpp );
@@ -101,11 +99,9 @@ const CppParserSettings& CppParserOptionsWidget::settings()
10199
}
102100
// --------------------------------------------------
103101

104-
void CppParserOptionsWidget::radioButtonWhatToggled()
102+
void CppParserOptionsWidget::checkBoxWhatToggled()
105103
{
106-
if( static_cast<QRadioButton*>( sender() )->isChecked() == true ) {
107-
m_settings.whatToCheck = static_cast<CppParserSettings::WhatToCheckOptions>( sender()->property( ENUM_VAL_PROPERTY ).toInt() );
108-
}
104+
m_settings.whatToCheck.setFlag( static_cast<CppParserSettings::WhatToCheck>( sender()->property( ENUM_VAL_PROPERTY ).toInt() ), static_cast<QAbstractButton *>( sender() )->isChecked() );
109105
}
110106
// --------------------------------------------------
111107

@@ -154,8 +150,8 @@ void CppParserOptionsWidget::updateWithSettings( const CppParserSettings* const
154150
ui->checkBoxRemoveEmailAddresses->setChecked( settings->removeEmailAddresses );
155151
ui->checkBoxIgnoreKeywords->setChecked( !settings->checkQtKeywords );
156152
ui->checkBoxIgnoreCaps->setChecked( !settings->checkAllCapsWords );
157-
QRadioButton* whatButtons[] = { nullptr, ui->radioButtonWhatComments, ui->radioButtonWhatLiterals, ui->radioButtonWhatBoth };
158-
whatButtons[settings->whatToCheck]->setChecked( true );
153+
ui->checkBoxWhatComments->setChecked(settings->whatToCheck.testFlag(CppParserSettings::CheckComments));
154+
ui->checkBoxWhatLiterals->setChecked(settings->whatToCheck.testFlag(CppParserSettings::CheckStringLiterals));
159155
QRadioButton* commentButtons[] = { nullptr, ui->radioButtonCommentsC, ui->radioButtonCommentsCpp, ui->radioButtonCommentsBoth };
160156
commentButtons[settings->commentsToCheck]->setChecked( true );
161157
QRadioButton* numberButtons[] = { ui->radioButtonNumbersRemove, ui->radioButtonNumbersSplit, ui->radioButtonNumbersLeave };

src/Parsers/CppParser/cppparseroptionswidget.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CppParserOptionsWidget
4545
const CppParserSettings& settings();
4646

4747
public slots:
48-
void radioButtonWhatToggled();
48+
void checkBoxWhatToggled();
4949
void radioButtonCommentsToggled();
5050
void radioButtonNumbersToggled();
5151
void radioButtonUnderscoresToggled();

0 commit comments

Comments
 (0)