forked from qt-creator/qt-creator
CMakeProjectManager: Register settings aspects more directly
Change-Id: I7bfbe3ad625b0902561975968221e90ce6af06d6 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -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")};
|
||||
};
|
||||
|
||||
@@ -51,20 +51,17 @@ CMakeSpecificSettings::CMakeSpecificSettings()
|
||||
setSettingsGroup("CMakeSpecificSettings");
|
||||
setAutoApply(false);
|
||||
|
||||
registerAspect(&autorunCMake);
|
||||
autorunCMake.setSettingsKey("AutorunCMake");
|
||||
autorunCMake.setDefaultValue(true);
|
||||
autorunCMake.setLabelText(::CMakeProjectManager::Tr::tr("Autorun CMake"));
|
||||
autorunCMake.setToolTip(::CMakeProjectManager::Tr::tr(
|
||||
"Automatically run CMake after changes to CMake project files."));
|
||||
|
||||
registerAspect(&ninjaPath);
|
||||
ninjaPath.setSettingsKey("NinjaPath");
|
||||
// never save this to the settings:
|
||||
ninjaPath.setToSettingsTransformation(
|
||||
[](const QVariant &) { return QVariant::fromValue(QString()); });
|
||||
|
||||
registerAspect(&packageManagerAutoSetup);
|
||||
packageManagerAutoSetup.setSettingsKey("PackageManagerAutoSetup");
|
||||
packageManagerAutoSetup.setDefaultValue(true);
|
||||
packageManagerAutoSetup.setLabelText(::CMakeProjectManager::Tr::tr("Package manager auto setup"));
|
||||
@@ -72,24 +69,20 @@ CMakeSpecificSettings::CMakeSpecificSettings()
|
||||
"pointing to a CMake script that will install dependencies from the conanfile.txt, "
|
||||
"conanfile.py, or vcpkg.json file from the project source directory."));
|
||||
|
||||
registerAspect(&askBeforeReConfigureInitialParams);
|
||||
askBeforeReConfigureInitialParams.setSettingsKey("AskReConfigureInitialParams");
|
||||
askBeforeReConfigureInitialParams.setDefaultValue(true);
|
||||
askBeforeReConfigureInitialParams.setLabelText(::CMakeProjectManager::Tr::tr("Ask before re-configuring with "
|
||||
"initial parameters"));
|
||||
|
||||
registerAspect(&askBeforePresetsReload);
|
||||
askBeforePresetsReload.setSettingsKey("AskBeforePresetsReload");
|
||||
askBeforePresetsReload.setDefaultValue(true);
|
||||
askBeforePresetsReload.setLabelText(::CMakeProjectManager::Tr::tr("Ask before reloading CMake Presets"));
|
||||
|
||||
registerAspect(&showSourceSubFolders);
|
||||
showSourceSubFolders.setSettingsKey("ShowSourceSubFolders");
|
||||
showSourceSubFolders.setDefaultValue(true);
|
||||
showSourceSubFolders.setLabelText(
|
||||
::CMakeProjectManager::Tr::tr("Show subfolders inside source group folders"));
|
||||
|
||||
registerAspect(&showAdvancedOptionsByDefault);
|
||||
showAdvancedOptionsByDefault.setSettingsKey("ShowAdvancedOptionsByDefault");
|
||||
showAdvancedOptionsByDefault.setDefaultValue(false);
|
||||
showAdvancedOptionsByDefault.setLabelText(
|
||||
|
||||
@@ -14,13 +14,13 @@ public:
|
||||
|
||||
static CMakeSpecificSettings *instance();
|
||||
|
||||
Utils::BoolAspect autorunCMake;
|
||||
Utils::FilePathAspect ninjaPath;
|
||||
Utils::BoolAspect packageManagerAutoSetup;
|
||||
Utils::BoolAspect askBeforeReConfigureInitialParams;
|
||||
Utils::BoolAspect askBeforePresetsReload;
|
||||
Utils::BoolAspect showSourceSubFolders;
|
||||
Utils::BoolAspect showAdvancedOptionsByDefault;
|
||||
Utils::BoolAspect autorunCMake{this};
|
||||
Utils::FilePathAspect ninjaPath{this};
|
||||
Utils::BoolAspect packageManagerAutoSetup{this};
|
||||
Utils::BoolAspect askBeforeReConfigureInitialParams{this};
|
||||
Utils::BoolAspect askBeforePresetsReload{this};
|
||||
Utils::BoolAspect showSourceSubFolders{this};
|
||||
Utils::BoolAspect showAdvancedOptionsByDefault{this};
|
||||
};
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
Reference in New Issue
Block a user