Use new FilePathAspect in a few more places

Change-Id: I910a802255c8d54a31313dcccb0d1a48ec577b7a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2023-05-15 18:32:22 +02:00
parent a928fee108
commit 95d21f3966
7 changed files with 11 additions and 16 deletions

View File

@@ -68,7 +68,7 @@ ConanInstallStep::ConanInstallStep(BuildStepList *bsl, Id id)
const QString buildType = bt == BuildConfiguration::Release ? QString("Release") const QString buildType = bt == BuildConfiguration::Release ? QString("Release")
: QString("Debug"); : QString("Debug");
CommandLine cmd(ConanPlugin::conanSettings()->conanFilePath.filePath()); CommandLine cmd(ConanPlugin::conanSettings()->conanFilePath());
cmd.addArgs({"install", "-s", "build_type=" + buildType}); cmd.addArgs({"install", "-s", "build_type=" + buildType});
if (buildMissing->value()) if (buildMissing->value())
cmd.addArg("--build=missing"); cmd.addArg("--build=missing");

View File

@@ -16,7 +16,6 @@ ConanSettings::ConanSettings()
registerAspect(&conanFilePath); registerAspect(&conanFilePath);
conanFilePath.setSettingsKey("ConanFilePath"); conanFilePath.setSettingsKey("ConanFilePath");
conanFilePath.setDisplayStyle(StringAspect::PathChooserDisplay);
conanFilePath.setExpectedKind(PathChooser::ExistingCommand); conanFilePath.setExpectedKind(PathChooser::ExistingCommand);
conanFilePath.setDefaultValue(HostOsInfo::withExecutableSuffix("conan")); conanFilePath.setDefaultValue(HostOsInfo::withExecutableSuffix("conan"));
} }

View File

@@ -12,7 +12,7 @@ class ConanSettings : public Utils::AspectContainer
public: public:
ConanSettings(); ConanSettings();
Utils::StringAspect conanFilePath; Utils::FilePathAspect conanFilePath;
}; };
} // Conan::Internal } // Conan::Internal

View File

@@ -56,8 +56,8 @@ void CopilotPlugin::extensionsInitialized()
void CopilotPlugin::restartClient() void CopilotPlugin::restartClient()
{ {
LanguageClient::LanguageClientManager::shutdownClient(m_client); LanguageClient::LanguageClientManager::shutdownClient(m_client);
m_client = new CopilotClient(CopilotSettings::instance().nodeJsPath.filePath(), m_client = new CopilotClient(CopilotSettings::instance().nodeJsPath(),
CopilotSettings::instance().distPath.filePath()); CopilotSettings::instance().distPath());
} }
} // namespace Internal } // namespace Internal

View File

@@ -36,10 +36,10 @@ CopilotSettings::CopilotSettings()
return fp.exists(); return fp.exists();
}); });
registerAspect(&nodeJsPath);
nodeJsPath.setExpectedKind(PathChooser::ExistingCommand); nodeJsPath.setExpectedKind(PathChooser::ExistingCommand);
nodeJsPath.setDefaultFilePath(nodeFromPath); nodeJsPath.setDefaultFilePath(nodeFromPath);
nodeJsPath.setSettingsKey("Copilot.NodeJsPath"); nodeJsPath.setSettingsKey("Copilot.NodeJsPath");
nodeJsPath.setDisplayStyle(StringAspect::PathChooserDisplay);
nodeJsPath.setLabelText(Tr::tr("Node.js path:")); nodeJsPath.setLabelText(Tr::tr("Node.js path:"));
nodeJsPath.setHistoryCompleter("Copilot.NodePath.History"); nodeJsPath.setHistoryCompleter("Copilot.NodePath.History");
nodeJsPath.setDisplayName(Tr::tr("Node.js Path")); nodeJsPath.setDisplayName(Tr::tr("Node.js Path"));
@@ -47,26 +47,23 @@ CopilotSettings::CopilotSettings()
Tr::tr("Select path to node.js executable. See https://nodejs.org/de/download/" Tr::tr("Select path to node.js executable. See https://nodejs.org/de/download/"
"for installation instructions.")); "for installation instructions."));
registerAspect(&distPath);
distPath.setExpectedKind(PathChooser::File); distPath.setExpectedKind(PathChooser::File);
distPath.setDefaultFilePath(distFromVim); distPath.setDefaultFilePath(distFromVim);
distPath.setSettingsKey("Copilot.DistPath"); distPath.setSettingsKey("Copilot.DistPath");
distPath.setDisplayStyle(StringAspect::PathChooserDisplay);
distPath.setLabelText(Tr::tr("Path to agent.js:")); distPath.setLabelText(Tr::tr("Path to agent.js:"));
distPath.setHistoryCompleter("Copilot.DistPath.History");
distPath.setDisplayName(Tr::tr("Agent.js path"));
distPath.setToolTip(Tr::tr( distPath.setToolTip(Tr::tr(
"Select path to agent.js in copilot neovim plugin. See " "Select path to agent.js in copilot neovim plugin. See "
"https://github.com/github/copilot.vim#getting-started for installation instructions.")); "https://github.com/github/copilot.vim#getting-started for installation instructions."));
distPath.setHistoryCompleter("Copilot.DistPath.History");
distPath.setDisplayName(Tr::tr("Agent.js path"));
registerAspect(&autoComplete);
autoComplete.setDisplayName(Tr::tr("Auto Complete")); autoComplete.setDisplayName(Tr::tr("Auto Complete"));
autoComplete.setLabelText(Tr::tr("Request completions automatically")); autoComplete.setLabelText(Tr::tr("Request completions automatically"));
autoComplete.setDefaultValue(true); autoComplete.setDefaultValue(true);
autoComplete.setToolTip(Tr::tr("Automatically request suggestions for the current text cursor " autoComplete.setToolTip(Tr::tr("Automatically request suggestions for the current text cursor "
"position after changes to the document")); "position after changes to the document"));
registerAspect(&nodeJsPath);
registerAspect(&distPath);
registerAspect(&autoComplete);
} }
} // namespace Copilot } // namespace Copilot

View File

@@ -14,8 +14,8 @@ public:
static CopilotSettings &instance(); static CopilotSettings &instance();
Utils::StringAspect nodeJsPath; Utils::FilePathAspect nodeJsPath;
Utils::StringAspect distPath; Utils::FilePathAspect distPath;
Utils::BoolAspect autoComplete; Utils::BoolAspect autoComplete;
}; };

View File

@@ -33,7 +33,6 @@ SubversionSettings::SubversionSettings()
setSettingsGroup("Subversion"); setSettingsGroup("Subversion");
registerAspect(&binaryPath); registerAspect(&binaryPath);
binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
binaryPath.setExpectedKind(PathChooser::ExistingCommand); binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setHistoryCompleter("Subversion.Command.History"); binaryPath.setHistoryCompleter("Subversion.Command.History");
binaryPath.setDefaultValue("svn" QTC_HOST_EXE_SUFFIX); binaryPath.setDefaultValue("svn" QTC_HOST_EXE_SUFFIX);