CppCheck: Register settingsaspect more directly

Change-Id: I325c7329618b4dbdd36bb1464627806e5f116bc0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-05-26 10:33:02 +02:00
parent 60da3a024a
commit b0b80c539b
2 changed files with 15 additions and 33 deletions

View File

@@ -34,7 +34,6 @@ CppcheckOptions::CppcheckOptions()
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER); setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
setSettingsGroup("Cppcheck"); setSettingsGroup("Cppcheck");
registerAspect(&binary);
binary.setSettingsKey("binary"); binary.setSettingsKey("binary");
binary.setExpectedKind(PathChooser::ExistingCommand); binary.setExpectedKind(PathChooser::ExistingCommand);
binary.setCommandVersionArguments({"--version"}); binary.setCommandVersionArguments({"--version"});
@@ -48,71 +47,57 @@ CppcheckOptions::CppcheckOptions()
binary.setDefaultValue(programFiles.pathAppended("Cppcheck/cppcheck.exe").toString()); binary.setDefaultValue(programFiles.pathAppended("Cppcheck/cppcheck.exe").toString());
} }
registerAspect(&warning);
warning.setSettingsKey("warning"); warning.setSettingsKey("warning");
warning.setDefaultValue(true); warning.setDefaultValue(true);
warning.setLabelText(Tr::tr("Warnings")); warning.setLabelText(Tr::tr("Warnings"));
registerAspect(&style);
style.setSettingsKey("style"); style.setSettingsKey("style");
style.setDefaultValue(true); style.setDefaultValue(true);
style.setLabelText(Tr::tr("Style")); style.setLabelText(Tr::tr("Style"));
registerAspect(&performance);
performance.setSettingsKey("performance"); performance.setSettingsKey("performance");
performance.setDefaultValue(true); performance.setDefaultValue(true);
performance.setLabelText(Tr::tr("Performance")); performance.setLabelText(Tr::tr("Performance"));
registerAspect(&portability);
portability.setSettingsKey("portability"); portability.setSettingsKey("portability");
portability.setDefaultValue(true); portability.setDefaultValue(true);
portability.setLabelText(Tr::tr("Portability")); portability.setLabelText(Tr::tr("Portability"));
registerAspect(&information);
information.setSettingsKey("information"); information.setSettingsKey("information");
information.setDefaultValue(true); information.setDefaultValue(true);
information.setLabelText(Tr::tr("Information")); information.setLabelText(Tr::tr("Information"));
registerAspect(&unusedFunction);
unusedFunction.setSettingsKey("unusedFunction"); unusedFunction.setSettingsKey("unusedFunction");
unusedFunction.setLabelText(Tr::tr("Unused functions")); unusedFunction.setLabelText(Tr::tr("Unused functions"));
unusedFunction.setToolTip(Tr::tr("Disables multithreaded check.")); unusedFunction.setToolTip(Tr::tr("Disables multithreaded check."));
registerAspect(&missingInclude);
missingInclude.setSettingsKey("missingInclude"); missingInclude.setSettingsKey("missingInclude");
missingInclude.setLabelText(Tr::tr("Missing includes")); missingInclude.setLabelText(Tr::tr("Missing includes"));
registerAspect(&inconclusive);
inconclusive.setSettingsKey("inconclusive"); inconclusive.setSettingsKey("inconclusive");
inconclusive.setLabelText(Tr::tr("Inconclusive errors")); inconclusive.setLabelText(Tr::tr("Inconclusive errors"));
registerAspect(&forceDefines);
forceDefines.setSettingsKey("forceDefines"); forceDefines.setSettingsKey("forceDefines");
forceDefines.setLabelText(Tr::tr("Check all define combinations")); forceDefines.setLabelText(Tr::tr("Check all define combinations"));
registerAspect(&customArguments);
customArguments.setSettingsKey("customArguments"); customArguments.setSettingsKey("customArguments");
customArguments.setDisplayStyle(StringAspect::LineEditDisplay); customArguments.setDisplayStyle(StringAspect::LineEditDisplay);
customArguments.setLabelText(Tr::tr("Custom arguments:")); customArguments.setLabelText(Tr::tr("Custom arguments:"));
registerAspect(&ignoredPatterns);
ignoredPatterns.setSettingsKey("ignoredPatterns"); ignoredPatterns.setSettingsKey("ignoredPatterns");
ignoredPatterns.setDisplayStyle(StringAspect::LineEditDisplay); ignoredPatterns.setDisplayStyle(StringAspect::LineEditDisplay);
ignoredPatterns.setLabelText(Tr::tr("Ignored file patterns:")); ignoredPatterns.setLabelText(Tr::tr("Ignored file patterns:"));
ignoredPatterns.setToolTip(Tr::tr("Comma-separated wildcards of full file paths. " ignoredPatterns.setToolTip(Tr::tr("Comma-separated wildcards of full file paths. "
"Files still can be checked if others include them.")); "Files still can be checked if others include them."));
registerAspect(&showOutput);
showOutput.setSettingsKey("showOutput"); showOutput.setSettingsKey("showOutput");
showOutput.setLabelText(Tr::tr("Show raw output")); showOutput.setLabelText(Tr::tr("Show raw output"));
registerAspect(&addIncludePaths);
addIncludePaths.setSettingsKey("addIncludePaths"); addIncludePaths.setSettingsKey("addIncludePaths");
addIncludePaths.setLabelText(Tr::tr("Add include paths")); addIncludePaths.setLabelText(Tr::tr("Add include paths"));
addIncludePaths.setToolTip(Tr::tr("Can find missing includes but makes " addIncludePaths.setToolTip(Tr::tr("Can find missing includes but makes "
"checking slower. Use only when needed.")); "checking slower. Use only when needed."));
registerAspect(&guessArguments);
guessArguments.setSettingsKey("guessArguments"); guessArguments.setSettingsKey("guessArguments");
guessArguments.setDefaultValue(true); guessArguments.setDefaultValue(true);
guessArguments.setLabelText(Tr::tr("Calculate additional arguments")); guessArguments.setLabelText(Tr::tr("Calculate additional arguments"));

View File

@@ -7,9 +7,6 @@
namespace Cppcheck::Internal { namespace Cppcheck::Internal {
class CppcheckTool;
class CppcheckTrigger;
class CppcheckOptions final : public Core::PagedSettings class CppcheckOptions final : public Core::PagedSettings
{ {
public: public:
@@ -17,22 +14,22 @@ public:
std::function<void(QWidget *widget)> layouter(); std::function<void(QWidget *widget)> layouter();
Utils::FilePathAspect binary; Utils::FilePathAspect binary{this};
Utils::BoolAspect warning; Utils::BoolAspect warning{this};
Utils::BoolAspect style; Utils::BoolAspect style{this};
Utils::BoolAspect performance; Utils::BoolAspect performance{this};
Utils::BoolAspect portability; Utils::BoolAspect portability{this};
Utils::BoolAspect information; Utils::BoolAspect information{this};
Utils::BoolAspect unusedFunction; Utils::BoolAspect unusedFunction{this};
Utils::BoolAspect missingInclude; Utils::BoolAspect missingInclude{this};
Utils::BoolAspect inconclusive; Utils::BoolAspect inconclusive{this};
Utils::BoolAspect forceDefines; Utils::BoolAspect forceDefines{this};
Utils::StringAspect customArguments; Utils::StringAspect customArguments{this};
Utils::StringAspect ignoredPatterns; Utils::StringAspect ignoredPatterns{this};
Utils::BoolAspect showOutput; Utils::BoolAspect showOutput{this};
Utils::BoolAspect addIncludePaths; Utils::BoolAspect addIncludePaths{this};
Utils::BoolAspect guessArguments; Utils::BoolAspect guessArguments{this};
}; };
} // Cppcheck::Internal } // Cppcheck::Internal