Use more FilePathAspect

Change-Id: Ib348df1460f8610607251498b07010df58d51ddf
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2023-05-17 17:18:11 +02:00
parent 2274847bfe
commit 6f31d87444
26 changed files with 53 additions and 66 deletions

View File

@@ -2079,8 +2079,8 @@ void CMakeBuildConfiguration::addToEnvironment(Utils::Environment &env) const
return;
auto settings = CMakeSpecificSettings::instance();
if (!settings->ninjaPath.filePath().isEmpty()) {
const Utils::FilePath ninja = settings->ninjaPath.filePath();
if (!settings->ninjaPath().isEmpty()) {
const Utils::FilePath ninja = settings->ninjaPath();
env.appendOrSetPath(ninja.isFile() ? ninja.parentDir() : ninja);
}
}

View File

@@ -52,7 +52,6 @@ public:
registerAspect(&command);
command.setSettingsKey("autoFormatCommand");
command.setDisplayStyle(StringAspect::PathChooserDisplay);
command.setDefaultValue("cmake-format");
command.setExpectedKind(PathChooser::ExistingCommand);
@@ -121,14 +120,14 @@ public:
TextEditor::Command formatCommand() const
{
TextEditor::Command cmd;
cmd.setExecutable(command.filePath());
cmd.setExecutable(command());
cmd.setProcessing(TextEditor::Command::FileProcessing);
cmd.addOption("--in-place");
cmd.addOption("%file");
return cmd;
}
StringAspect command;
FilePathAspect command;
BoolAspect autoFormatOnSave;
BoolAspect autoFormatOnlyCurrentProject;
StringAspect autoFormatMime;

View File

@@ -678,7 +678,7 @@ QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const
if (it != known.constEnd()) {
const bool hasNinja = [k, tool] {
auto settings = Internal::CMakeSpecificSettings::instance();
if (settings->ninjaPath.filePath().isEmpty()) {
if (settings->ninjaPath().isEmpty()) {
auto findNinja = [](const Environment &env) -> bool {
return !env.searchInPath("ninja").isEmpty();
};

View File

@@ -32,9 +32,9 @@ CMakeSpecificSettings::CMakeSpecificSettings()
setCategory(Constants::Settings::CATEGORY);
setCategoryIconPath(Constants::Icons::SETTINGS_CATEGORY);
setLayouter([this](QWidget *widget) {
setLayouter([this] {
using namespace Layouting;
Column {
return Column {
autorunCMake,
packageManagerAutoSetup,
askBeforeReConfigureInitialParams,
@@ -42,7 +42,7 @@ CMakeSpecificSettings::CMakeSpecificSettings()
showSourceSubFolders,
showAdvancedOptionsByDefault,
st
}.attachTo(widget);
};
});
// TODO: fixup of QTCREATORBUG-26289 , remove in Qt Creator 7 or so

View File

@@ -15,7 +15,7 @@ public:
static CMakeSpecificSettings *instance();
Utils::BoolAspect autorunCMake;
Utils::StringAspect ninjaPath;
Utils::FilePathAspect ninjaPath;
Utils::BoolAspect packageManagerAutoSetup;
Utils::BoolAspect askBeforeReConfigureInitialParams;
Utils::BoolAspect askBeforePresetsReload;