From 35a8cd46ab6536ee100f271fb7db6b14c70b30b6 Mon Sep 17 00:00:00 2001 From: Eugene Shalygin Date: Thu, 20 Jun 2024 09:36:48 +0200 Subject: [PATCH 1/3] Add missing capture to a lambda --- src/Parsers/CppParser/cppdocumentparser.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Parsers/CppParser/cppdocumentparser.cpp b/src/Parsers/CppParser/cppdocumentparser.cpp index 60bdb47..9c83606 100644 --- a/src/Parsers/CppParser/cppdocumentparser.cpp +++ b/src/Parsers/CppParser/cppdocumentparser.cpp @@ -393,12 +393,11 @@ CppDocumentParser::CppDocumentParser( QObject* parent ) CppEditor::CppModelManager* modelManager = CppEditor::CppModelManager::instance(); connect( modelManager, &CppEditor::CppModelManager::documentUpdated, this, &CppDocumentParser::parseCppDocumentOnUpdate, Qt::DirectConnection ); - connect( qApp, &QApplication::aboutToQuit, this, [=]() { - /* Disconnect any signals that might still get emitted. */ - modelManager->disconnect( this ); - SpellCheckerCore::instance()->disconnect( this ); - this->disconnect( SpellCheckerCore::instance() ); - }, Qt::DirectConnection ); + connect( qApp, &QApplication::aboutToQuit, this, [=, this]() { + /* Disconnect any signals that might still get emitted. */ + modelManager->disconnect( this ); + SpellCheckerCore::instance()->disconnect( this ); + this->disconnect( SpellCheckerCore::instance() ); }, Qt::DirectConnection ); Core::Context context( CppEditor::Constants::CPPEDITOR_ID ); Core::ActionContainer* cppEditorContextMenu = Core::ActionManager::createMenu( CppEditor::Constants::M_CONTEXT ); From cacd2b552bd08414a48a70fc2194087612c2437d Mon Sep 17 00:00:00 2001 From: Eugene Shalygin Date: Wed, 19 Jun 2024 23:46:07 +0200 Subject: [PATCH 2/3] Remove option WhatToCheck::CheckBoth In preparation to add CheckIndentifiers, this mode needs to be removed. --- .../CppParser/cppparseroptionswidget.cpp | 22 +- .../CppParser/cppparseroptionswidget.h | 2 +- .../CppParser/cppparseroptionswidget.ui | 301 +++++------------- src/Parsers/CppParser/cppparsersettings.cpp | 2 +- src/Parsers/CppParser/cppparsersettings.h | 1 - 5 files changed, 91 insertions(+), 237 deletions(-) diff --git a/src/Parsers/CppParser/cppparseroptionswidget.cpp b/src/Parsers/CppParser/cppparseroptionswidget.cpp index 12a7650..27777f9 100644 --- a/src/Parsers/CppParser/cppparseroptionswidget.cpp +++ b/src/Parsers/CppParser/cppparseroptionswidget.cpp @@ -37,12 +37,10 @@ CppParserOptionsWidget::CppParserOptionsWidget( const CppParserSettings* const s ui->labelDescriptionEmail->setText( ui->labelDescriptionEmail->text().arg( QLatin1String( SpellChecker::Parsers::CppParser::Constants::EMAIL_ADDRESS_REGEXP_PATTERN ) ) ); ui->labelDescriptionWebsites->setText( ui->labelDescriptionWebsites->text().arg( QLatin1String( SpellChecker::Parsers::CppParser::Constants::WEBSITE_ADDRESS_REGEXP_PATTERN ) ) ); /* Set up the options for What to Check */ - ui->radioButtonWhatComments->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckComments ); - ui->radioButtonWhatLiterals->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckStringLiterals ); - ui->radioButtonWhatBoth->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckBoth ); - connect( ui->radioButtonWhatComments, &QRadioButton::toggled, this, &CppParserOptionsWidget::radioButtonWhatToggled ); - connect( ui->radioButtonWhatLiterals, &QRadioButton::toggled, this, &CppParserOptionsWidget::radioButtonWhatToggled ); - connect( ui->radioButtonWhatBoth, &QRadioButton::toggled, this, &CppParserOptionsWidget::radioButtonWhatToggled ); + ui->checkBoxWhatComments->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckComments ); + ui->checkBoxWhatLiterals->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckStringLiterals ); + connect( ui->checkBoxWhatComments, &QAbstractButton::toggled, this, &CppParserOptionsWidget::checkBoxWhatToggled ); + connect( ui->checkBoxWhatLiterals, &QAbstractButton::toggled, this, &CppParserOptionsWidget::checkBoxWhatToggled ); /* Set up the options for Comments to Check */ ui->radioButtonCommentsC->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CommentsC ); ui->radioButtonCommentsCpp->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CommentsCpp ); @@ -101,11 +99,9 @@ const CppParserSettings& CppParserOptionsWidget::settings() } // -------------------------------------------------- -void CppParserOptionsWidget::radioButtonWhatToggled() +void CppParserOptionsWidget::checkBoxWhatToggled() { - if( static_cast( sender() )->isChecked() == true ) { - m_settings.whatToCheck = static_cast( sender()->property( ENUM_VAL_PROPERTY ).toInt() ); - } + m_settings.whatToCheck.setFlag( static_cast( sender()->property( ENUM_VAL_PROPERTY ).toInt() ), static_cast( sender() )->isChecked() ); } // -------------------------------------------------- @@ -154,9 +150,9 @@ void CppParserOptionsWidget::updateWithSettings( const CppParserSettings* const ui->checkBoxRemoveEmailAddresses->setChecked( settings->removeEmailAddresses ); ui->checkBoxIgnoreKeywords->setChecked( !settings->checkQtKeywords ); ui->checkBoxIgnoreCaps->setChecked( !settings->checkAllCapsWords ); - QRadioButton* whatButtons[] = { nullptr, ui->radioButtonWhatComments, ui->radioButtonWhatLiterals, ui->radioButtonWhatBoth }; - whatButtons[settings->whatToCheck]->setChecked( true ); - QRadioButton* commentButtons[] = { nullptr, ui->radioButtonCommentsC, ui->radioButtonCommentsCpp, ui->radioButtonCommentsBoth }; + ui->checkBoxWhatComments->setChecked( settings->whatToCheck.testFlag( CppParserSettings::CheckComments ) ); + ui->checkBoxWhatLiterals->setChecked( settings->whatToCheck.testFlag( CppParserSettings::CheckStringLiterals ) ); + QRadioButton *commentButtons[] = { nullptr, ui->radioButtonCommentsC, ui->radioButtonCommentsCpp, ui->radioButtonCommentsBoth }; commentButtons[settings->commentsToCheck]->setChecked( true ); QRadioButton* numberButtons[] = { ui->radioButtonNumbersRemove, ui->radioButtonNumbersSplit, ui->radioButtonNumbersLeave }; numberButtons[settings->wordsWithNumberOption]->setChecked( true ); diff --git a/src/Parsers/CppParser/cppparseroptionswidget.h b/src/Parsers/CppParser/cppparseroptionswidget.h index 29dcdfa..801232d 100644 --- a/src/Parsers/CppParser/cppparseroptionswidget.h +++ b/src/Parsers/CppParser/cppparseroptionswidget.h @@ -45,7 +45,7 @@ class CppParserOptionsWidget const CppParserSettings& settings(); public slots: - void radioButtonWhatToggled(); + void checkBoxWhatToggled(); void radioButtonCommentsToggled(); void radioButtonNumbersToggled(); void radioButtonUnderscoresToggled(); diff --git a/src/Parsers/CppParser/cppparseroptionswidget.ui b/src/Parsers/CppParser/cppparseroptionswidget.ui index 59c1c3b..98c1a2b 100644 --- a/src/Parsers/CppParser/cppparseroptionswidget.ui +++ b/src/Parsers/CppParser/cppparseroptionswidget.ui @@ -54,10 +54,10 @@ QScrollArea { padding: 3px } - QFrame::NoFrame + QFrame::Shape::NoFrame - QFrame::Sunken + QFrame::Shadow::Sunken true @@ -68,7 +68,7 @@ 0 0 801 - 1638 + 1803 @@ -106,25 +106,18 @@ - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 - - - - Comments only - - - - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -148,27 +141,20 @@ - Only Comments will be checked for spelling mistakes. This includes normal and doxygen comments. Eg: /* Comment to Check */ + Comments will be checked for spelling mistakes. This includes normal and doxygen comments. Eg: /* Comment to Check */ true - - - - String Literals only - - - - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -192,27 +178,20 @@ - Only String Literals will be checked for spelling mistakes. A String Literal is a string inside inverted commas. Eg: "String to Check". + String Literals will be checked for spelling mistakes. A String Literal is a string inside inverted commas. Eg: "String to Check". true - - - - Comments and String Literals - - - - + - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -222,24 +201,17 @@ - - - - - 0 - 0 - - - - - true - - + + - Comments and String Literals will be checked. + Comments - - true + + + + + + String Literals @@ -259,7 +231,7 @@ - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -274,10 +246,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -318,10 +290,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -362,10 +334,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -411,7 +383,7 @@ First Comment - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter false @@ -421,7 +393,7 @@ - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -436,10 +408,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -487,7 +459,7 @@ A multi-line C++ comment will not behave as expected since all lines are interpr Email Addresses - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter false @@ -497,7 +469,7 @@ A multi-line C++ comment will not behave as expected since all lines are interpr - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -512,10 +484,10 @@ A multi-line C++ comment will not behave as expected since all lines are interpr - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -562,7 +534,7 @@ The match pattern used is: %1 Qt Keywords - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter false @@ -572,7 +544,7 @@ The match pattern used is: %1 - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -587,10 +559,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -637,7 +609,7 @@ The match pattern used is: %1 - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -673,10 +645,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -702,7 +674,7 @@ The match pattern used is: %1 - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -717,10 +689,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -761,10 +733,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -805,10 +777,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -855,7 +827,7 @@ The match pattern used is: %1 - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -870,10 +842,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -914,10 +886,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -958,10 +930,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1008,7 +980,7 @@ The match pattern used is: %1 - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -1023,10 +995,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1067,10 +1039,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1111,10 +1083,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1161,7 +1133,7 @@ The match pattern used is: %1 - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -1176,10 +1148,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1226,7 +1198,7 @@ The match pattern used is: %1 - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -1241,10 +1213,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1285,10 +1257,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1329,10 +1301,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1379,7 +1351,7 @@ The match pattern used is: %1 - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow 0 @@ -1394,10 +1366,10 @@ The match pattern used is: %1 - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1440,9 +1412,8 @@ The match pattern used is: %1 checkBoxDescriptions - radioButtonWhatComments - radioButtonWhatLiterals - radioButtonWhatBoth + checkBoxWhatComments + checkBoxWhatLiterals scrollArea radioButtonCommentsC radioButtonCommentsCpp @@ -1771,70 +1742,6 @@ The match pattern used is: %1 - - checkBoxDescriptions - toggled(bool) - label_21 - setHidden(bool) - - - 281 - 24 - - - 325 - 146 - - - - - radioButtonWhatComments - toggled(bool) - groupBox_11 - setEnabled(bool) - - - 324 - 72 - - - 321 - 213 - - - - - radioButtonWhatLiterals - toggled(bool) - groupBox_11 - setDisabled(bool) - - - 424 - 103 - - - 386 - 205 - - - - - radioButtonWhatBoth - toggled(bool) - groupBox_11 - setEnabled(bool) - - - 431 - 133 - - - 410 - 206 - - - checkBoxDescriptions toggled(bool) @@ -1899,53 +1806,5 @@ The match pattern used is: %1 - - radioButtonWhatBoth - toggled(bool) - groupBox_13 - setEnabled(bool) - - - 152 - 128 - - - 120 - 298 - - - - - radioButtonWhatLiterals - toggled(bool) - groupBox_13 - setDisabled(bool) - - - 143 - 95 - - - 156 - 313 - - - - - radioButtonWhatComments - toggled(bool) - groupBox_13 - setEnabled(bool) - - - 92 - 68 - - - 96 - 298 - - - diff --git a/src/Parsers/CppParser/cppparsersettings.cpp b/src/Parsers/CppParser/cppparsersettings.cpp index 9699c93..fdc56be 100644 --- a/src/Parsers/CppParser/cppparsersettings.cpp +++ b/src/Parsers/CppParser/cppparsersettings.cpp @@ -113,7 +113,7 @@ void CppParserSettings::saveToSetting(Utils::QtcSettings *settings ) const void CppParserSettings::setDefaults() { - whatToCheck = CheckBoth; + whatToCheck = { CheckComments | CheckStringLiterals }; commentsToCheck = CommentsBoth; removeEmailAddresses = true; checkQtKeywords = false; diff --git a/src/Parsers/CppParser/cppparsersettings.h b/src/Parsers/CppParser/cppparsersettings.h index 211b3ca..05ab994 100644 --- a/src/Parsers/CppParser/cppparsersettings.h +++ b/src/Parsers/CppParser/cppparsersettings.h @@ -43,7 +43,6 @@ class CppParserSettings Tokens_NONE = 0, /*!< Invalid option needed for QFLAGS. */ CheckComments = 1 << 0, /*!< Check Comments. */ CheckStringLiterals = 1 << 1, /*!< Check String Literals */ - CheckBoth = CheckComments | CheckStringLiterals }; Q_DECLARE_FLAGS( WhatToCheckOptions, WhatToCheck ) From 06bf506d9bdb1aef06e2ae0d0888a78f0bebf892 Mon Sep 17 00:00:00 2001 From: Eugene Shalygin Date: Thu, 20 Jun 2024 08:18:25 +0200 Subject: [PATCH 3/3] Add checks for identifiers --- src/Parsers/CppParser/cppdocumentparser.cpp | 1 - .../CppParser/cppdocumentprocessor.cpp | 17 ++++++ src/Parsers/CppParser/cppdocumentprocessor.h | 3 +- .../CppParser/cppparseroptionswidget.cpp | 3 + .../CppParser/cppparseroptionswidget.ui | 55 ++++++++++++++++--- src/Parsers/CppParser/cppparsersettings.h | 7 ++- 6 files changed, 74 insertions(+), 12 deletions(-) diff --git a/src/Parsers/CppParser/cppdocumentparser.cpp b/src/Parsers/CppParser/cppdocumentparser.cpp index 9c83606..cffa94f 100644 --- a/src/Parsers/CppParser/cppdocumentparser.cpp +++ b/src/Parsers/CppParser/cppdocumentparser.cpp @@ -398,7 +398,6 @@ CppDocumentParser::CppDocumentParser( QObject* parent ) modelManager->disconnect( this ); SpellCheckerCore::instance()->disconnect( this ); this->disconnect( SpellCheckerCore::instance() ); }, Qt::DirectConnection ); - Core::Context context( CppEditor::Constants::CPPEDITOR_ID ); Core::ActionContainer* cppEditorContextMenu = Core::ActionManager::createMenu( CppEditor::Constants::M_CONTEXT ); Core::ActionContainer* contextMenu = Core::ActionManager::createMenu( Constants::CONTEXT_MENU_ID ); diff --git a/src/Parsers/CppParser/cppdocumentprocessor.cpp b/src/Parsers/CppParser/cppdocumentprocessor.cpp index 67b7979..bb86baf 100644 --- a/src/Parsers/CppParser/cppdocumentprocessor.cpp +++ b/src/Parsers/CppParser/cppdocumentprocessor.cpp @@ -155,6 +155,23 @@ void CppDocumentProcessor::process( CppDocumentProcessor::Promise& promise ) return; } + if (d->settings.whatToCheck.testFlag(CppParserSettings::CheckIdentifiers)) { + /* Parse identifiers (consider merging all the 3 loops, because we now touch each token) */ + unsigned int tokenCount = d->trUnit->tokenCount(); + for ( unsigned int tokenIndex = 0; tokenIndex < tokenCount; ++tokenIndex ) { + const CPlusPlus::Token &token{ d->trUnit->tokenAt( tokenIndex ) }; + const CPlusPlus::Identifier *identifier{ token.identifier }; + if ( identifier ) { + wordTokens.push_back( parseToken( token, WordTokens::Type::Identifier ) ); + } + } + } + + if (promise.isCanceled() == true) { + promise.future().cancel(); + return; + } + /* At this point the DocPtr can be released since it will no longer be * Used */ d->docPtr->releaseSourceAndAST(); diff --git a/src/Parsers/CppParser/cppdocumentprocessor.h b/src/Parsers/CppParser/cppdocumentprocessor.h index dabab4a..cf1cd47 100644 --- a/src/Parsers/CppParser/cppdocumentprocessor.h +++ b/src/Parsers/CppParser/cppdocumentprocessor.h @@ -56,7 +56,8 @@ struct WordTokens enum class Type { Comment = 0, Doxygen, - Literal + Literal, + Identifier, }; HashWords::key_type hash; diff --git a/src/Parsers/CppParser/cppparseroptionswidget.cpp b/src/Parsers/CppParser/cppparseroptionswidget.cpp index 27777f9..ae432a8 100644 --- a/src/Parsers/CppParser/cppparseroptionswidget.cpp +++ b/src/Parsers/CppParser/cppparseroptionswidget.cpp @@ -39,8 +39,10 @@ CppParserOptionsWidget::CppParserOptionsWidget( const CppParserSettings* const s /* Set up the options for What to Check */ ui->checkBoxWhatComments->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckComments ); ui->checkBoxWhatLiterals->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckStringLiterals ); + ui->checkBoxWhatIdentifiers->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CheckIdentifiers ); connect( ui->checkBoxWhatComments, &QAbstractButton::toggled, this, &CppParserOptionsWidget::checkBoxWhatToggled ); connect( ui->checkBoxWhatLiterals, &QAbstractButton::toggled, this, &CppParserOptionsWidget::checkBoxWhatToggled ); + connect( ui->checkBoxWhatIdentifiers, &QAbstractButton::toggled, this, &CppParserOptionsWidget::checkBoxWhatToggled ); /* Set up the options for Comments to Check */ ui->radioButtonCommentsC->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CommentsC ); ui->radioButtonCommentsCpp->setProperty( ENUM_VAL_PROPERTY, CppParserSettings::CommentsCpp ); @@ -152,6 +154,7 @@ void CppParserOptionsWidget::updateWithSettings( const CppParserSettings* const ui->checkBoxIgnoreCaps->setChecked( !settings->checkAllCapsWords ); ui->checkBoxWhatComments->setChecked( settings->whatToCheck.testFlag( CppParserSettings::CheckComments ) ); ui->checkBoxWhatLiterals->setChecked( settings->whatToCheck.testFlag( CppParserSettings::CheckStringLiterals ) ); + ui->checkBoxWhatIdentifiers->setChecked( settings->whatToCheck.testFlag( CppParserSettings::CheckIdentifiers ) ); QRadioButton *commentButtons[] = { nullptr, ui->radioButtonCommentsC, ui->radioButtonCommentsCpp, ui->radioButtonCommentsBoth }; commentButtons[settings->commentsToCheck]->setChecked( true ); QRadioButton* numberButtons[] = { ui->radioButtonNumbersRemove, ui->radioButtonNumbersSplit, ui->radioButtonNumbersLeave }; diff --git a/src/Parsers/CppParser/cppparseroptionswidget.ui b/src/Parsers/CppParser/cppparseroptionswidget.ui index 98c1a2b..55303d7 100644 --- a/src/Parsers/CppParser/cppparseroptionswidget.ui +++ b/src/Parsers/CppParser/cppparseroptionswidget.ui @@ -68,7 +68,7 @@ 0 0 801 - 1803 + 1843 @@ -111,6 +111,13 @@ 0 + + + + Comments + + + @@ -148,6 +155,13 @@ + + + + String Literals + + + @@ -201,20 +215,47 @@ - - + + - Comments + Identifiers - - + + + + + 0 + 0 + + + + + true + + - String Literals + Identifiers, such as variable, type, and function names. + + + + Qt::Orientation::Horizontal + + + QSizePolicy::Policy::Fixed + + + + 40 + 0 + + + + diff --git a/src/Parsers/CppParser/cppparsersettings.h b/src/Parsers/CppParser/cppparsersettings.h index 05ab994..58723b7 100644 --- a/src/Parsers/CppParser/cppparsersettings.h +++ b/src/Parsers/CppParser/cppparsersettings.h @@ -40,9 +40,10 @@ class CppParserSettings ~CppParserSettings(); enum WhatToCheck { - Tokens_NONE = 0, /*!< Invalid option needed for QFLAGS. */ - CheckComments = 1 << 0, /*!< Check Comments. */ - CheckStringLiterals = 1 << 1, /*!< Check String Literals */ + Tokens_NONE = 0, /*!< Invalid option needed for QFLAGS. */ + CheckComments = 1 << 0, /*!< Check Comments. */ + CheckStringLiterals = 1 << 1, /*!< Check String Literals */ + CheckIdentifiers = 1 << 2, /*!< Check Identifiers */ }; Q_DECLARE_FLAGS( WhatToCheckOptions, WhatToCheck )