CMakeProjectManager: Register settings aspects more directly

Change-Id: I7bfbe3ad625b0902561975968221e90ce6af06d6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-05-26 10:11:55 +02:00
parent 4e60203132
commit a69489cd1e
3 changed files with 11 additions and 22 deletions

View File

@@ -50,21 +50,17 @@ public:
setDisplayCategory("CMake");
setCategory(Constants::Settings::CATEGORY);
registerAspect(&command);
command.setSettingsKey("autoFormatCommand");
command.setDefaultValue("cmake-format");
command.setExpectedKind(PathChooser::ExistingCommand);
registerAspect(&autoFormatOnSave);
autoFormatOnSave.setSettingsKey("autoFormatOnSave");
autoFormatOnSave.setLabelText(Tr::tr("Enable auto format on file save"));
registerAspect(&autoFormatOnlyCurrentProject);
autoFormatOnlyCurrentProject.setSettingsKey("autoFormatOnlyCurrentProject");
autoFormatOnlyCurrentProject.setDefaultValue(true);
autoFormatOnlyCurrentProject.setLabelText(Tr::tr("Restrict to files contained in the current project"));
registerAspect(&autoFormatMime);
autoFormatMime.setSettingsKey("autoFormatMime");
autoFormatMime.setDefaultValue("text/x-cmake");
autoFormatMime.setLabelText(Tr::tr("Restrict to MIME types:"));
@@ -127,10 +123,10 @@ public:
return cmd;
}
FilePathAspect command;
BoolAspect autoFormatOnSave;
BoolAspect autoFormatOnlyCurrentProject;
StringAspect autoFormatMime;
FilePathAspect command{this};
BoolAspect autoFormatOnSave{this};
BoolAspect autoFormatOnlyCurrentProject{this};
StringAspect autoFormatMime{this};
QAction formatFile{Tr::tr("Format &Current File")};
};