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

View File

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