forked from qt-creator/qt-creator
Utils: Introduce FilePathAspect::setDefaultPathValue(FilePath)
... as a convenience function for .setDefaultValue(filePath.toUserOutput()); The case that someone already has FilePaths should not look (much) uglier on the user side than the QString "raw" case. Direct overloading setDefaultValue(FilePath) causes resolution conflicts, which are solvable, but I'd rather keep it explicit now. Change-Id: I03d71e4f99005a1d1f76ebf23080bebe46a9351d Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -1442,6 +1442,11 @@ void FilePathAspect::setDefaultValue(const QString &filePath)
|
||||
TypedAspect::setDefaultValue(filePath);
|
||||
}
|
||||
|
||||
void FilePathAspect::setDefaultPathValue(const FilePath &filePath)
|
||||
{
|
||||
TypedAspect::setDefaultValue(filePath.toUserOutput());
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a check box with a \a checkerLabel according to \a checkBoxPlacement
|
||||
to the line edit.
|
||||
|
@@ -666,6 +666,7 @@ public:
|
||||
void setValue(const FilePath &filePath, Announcement howToAnnounce = DoEmit);
|
||||
void setValue(const QString &filePath, Announcement howToAnnounce = DoEmit);
|
||||
void setDefaultValue(const QString &filePath);
|
||||
void setDefaultPathValue(const FilePath &filePath);
|
||||
|
||||
void setPromptDialogFilter(const QString &filter);
|
||||
void setPromptDialogTitle(const QString &title);
|
||||
|
@@ -68,7 +68,7 @@ CopilotSettings::CopilotSettings()
|
||||
const FilePath distFromVim = findOrDefault(searchDirs, &FilePath::exists);
|
||||
|
||||
nodeJsPath.setExpectedKind(PathChooser::ExistingCommand);
|
||||
nodeJsPath.setDefaultValue(nodeFromPath.toUserOutput());
|
||||
nodeJsPath.setDefaultPathValue(nodeFromPath);
|
||||
nodeJsPath.setSettingsKey("Copilot.NodeJsPath");
|
||||
nodeJsPath.setLabelText(Tr::tr("Node.js path:"));
|
||||
nodeJsPath.setHistoryCompleter("Copilot.NodePath.History");
|
||||
@@ -79,7 +79,7 @@ CopilotSettings::CopilotSettings()
|
||||
.arg("https://nodejs.org/en/download/"));
|
||||
|
||||
distPath.setExpectedKind(PathChooser::File);
|
||||
distPath.setDefaultValue(distFromVim.toUserOutput());
|
||||
distPath.setDefaultPathValue(distFromVim);
|
||||
distPath.setSettingsKey("Copilot.DistPath");
|
||||
distPath.setLabelText(Tr::tr("Path to agent.js:"));
|
||||
distPath.setHistoryCompleter("Copilot.DistPath.History");
|
||||
|
@@ -57,7 +57,7 @@ ScreenRecorderSettings::ScreenRecorderSettings()
|
||||
const FilePath ffmpegDefault
|
||||
= Environment::systemEnvironment().searchInPath(Constants::FFMPEG_COMMAND,
|
||||
FileUtils::usefulExtraSearchPaths());
|
||||
ffmpegTool.setDefaultValue(ffmpegDefault.toUserOutput());
|
||||
ffmpegTool.setDefaultPathValue(ffmpegDefault);
|
||||
ffmpegTool.setLabelText(Tr::tr("ffmpeg tool:"));
|
||||
|
||||
ffprobeTool.setSettingsKey("FFprobeTool");
|
||||
@@ -66,7 +66,7 @@ ScreenRecorderSettings::ScreenRecorderSettings()
|
||||
const FilePath ffprobeDefault
|
||||
= Environment::systemEnvironment().searchInPath(Constants::FFPROBE_COMMAND,
|
||||
FileUtils::usefulExtraSearchPaths());
|
||||
ffprobeTool.setDefaultValue(ffprobeDefault.toUserOutput());
|
||||
ffprobeTool.setDefaultPathValue(ffprobeDefault);
|
||||
ffprobeTool.setLabelText(Tr::tr("ffprobe tool:"));
|
||||
|
||||
captureCursor.setSettingsKey("CaptureCursor");
|
||||
|
@@ -40,7 +40,7 @@ VcpkgSettings::VcpkgSettings()
|
||||
if (!defaultPath.isDir())
|
||||
defaultPath = FilePath::fromUserInput(qtcEnvironmentVariable(Constants::ENVVAR_VCPKG_ROOT));
|
||||
if (defaultPath.isDir())
|
||||
vcpkgRoot.setDefaultValue(defaultPath.toUserOutput());
|
||||
vcpkgRoot.setDefaultPathValue(defaultPath);
|
||||
|
||||
connect(this, &AspectContainer::applied, this, &VcpkgSettings::setVcpkgRootEnvironmentVariable);
|
||||
|
||||
|
Reference in New Issue
Block a user