Utils: Make FilePathAspect::value() return a QString

This is meant to be the "internal", raw, unexpanded value that does not
necessarily match a scheme://host/path pattern before expansion.

Change-Id: I627afbe1e9682d85c5bb04542c7354760ba9a13f
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-07-18 09:14:47 +02:00
parent 0a37ff4149
commit 0f91561667
8 changed files with 12 additions and 17 deletions

View File

@@ -1319,17 +1319,12 @@ FilePath FilePathAspect::operator()() const
return FilePath::fromUserInput(StringAspect::value()); return FilePath::fromUserInput(StringAspect::value());
} }
FilePath FilePathAspect::value() const
{
return FilePath::fromUserInput(StringAspect::value());
}
FilePath FilePathAspect::expandedValue() const FilePath FilePathAspect::expandedValue() const
{ {
return FilePath::fromUserInput(StringAspect::value()); return FilePath::fromUserInput(StringAspect::value());
} }
QString FilePathAspect::stringValue() const QString FilePathAspect::value() const
{ {
return StringAspect::value(); return StringAspect::value();
} }

View File

@@ -546,9 +546,8 @@ public:
FilePathAspect(AspectContainer *container = nullptr); FilePathAspect(AspectContainer *container = nullptr);
FilePath operator()() const; FilePath operator()() const;
FilePath value() const;
FilePath expandedValue() const; FilePath expandedValue() const;
QString stringValue() const; QString value() const;
void setValue(const FilePath &filePath); void setValue(const FilePath &filePath);
void setDefaultValue(const FilePath &filePath); void setDefaultValue(const FilePath &filePath);

View File

@@ -764,9 +764,9 @@ bool FossilClient::managesFile(const FilePath &workingDirectory, const QString &
unsigned int FossilClient::binaryVersion() const unsigned int FossilClient::binaryVersion() const
{ {
static unsigned int cachedBinaryVersion = 0; static unsigned int cachedBinaryVersion = 0;
static QString cachedBinaryPath; static FilePath cachedBinaryPath;
const QString currentBinaryPath = settings().binaryPath.stringValue(); const FilePath currentBinaryPath = settings().binaryPath();
if (currentBinaryPath.isEmpty()) if (currentBinaryPath.isEmpty())
return 0; return 0;

View File

@@ -58,7 +58,7 @@ QString FossilJsExtension::defaultSslIdentityFile() const
if (!isConfigured()) if (!isConfigured())
return QString(); return QString();
return settings().sslIdentityFile.stringValue(); return settings().sslIdentityFile().toFSPathString();
} }
QString FossilJsExtension::defaultLocalRepoPath() const QString FossilJsExtension::defaultLocalRepoPath() const
@@ -66,7 +66,7 @@ QString FossilJsExtension::defaultLocalRepoPath() const
if (!isConfigured()) if (!isConfigured())
return QString(); return QString();
return settings().defaultRepoPath.stringValue(); return settings().defaultRepoPath().toFSPathString();
} }
bool FossilJsExtension::defaultDisableAutosync() const bool FossilJsExtension::defaultDisableAutosync() const

View File

@@ -60,7 +60,7 @@ BuildDirectoryAspect::BuildDirectoryAspect(AspectContainer *container, const Bui
}); });
setOpenTerminalHandler([this, bc] { setOpenTerminalHandler([this, bc] {
Core::FileUtils::openTerminal(value(), bc->environment()); Core::FileUtils::openTerminal(expandedValue(), bc->environment());
}); });
} }

View File

@@ -228,7 +228,7 @@ BuildConfiguration::~BuildConfiguration()
FilePath BuildConfiguration::buildDirectory() const FilePath BuildConfiguration::buildDirectory() const
{ {
FilePath path = FilePath::fromUserInput( FilePath path = FilePath::fromUserInput(
environment().expandVariables(d->m_buildDirectoryAspect.stringValue().trimmed())); environment().expandVariables(d->m_buildDirectoryAspect.value().trimmed()));
// FIXME: If the macro expander is expected to be able to do some // FIXME: If the macro expander is expected to be able to do some
// structual changes, the fromUserInput() above might already have // structual changes, the fromUserInput() above might already have
// mis-parsed. Should this here be encapsulated in the FilePathAspect? // mis-parsed. Should this here be encapsulated in the FilePathAspect?

View File

@@ -38,7 +38,8 @@ VcsBaseSettings::~VcsBaseSettings() = default;
FilePaths VcsBaseSettings::searchPathList() const FilePaths VcsBaseSettings::searchPathList() const
{ {
return Utils::transform(path.stringValue().split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts), // FIXME: Filepathify
return Utils::transform(path.value().split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts),
&FilePath::fromUserInput); &FilePath::fromUserInput);
} }

View File

@@ -174,7 +174,7 @@ void VcsBaseSubmitEditor::setParameters(const VcsBaseSubmitEditorParameters &par
const CommonVcsSettings &settings = commonSettings(); const CommonVcsSettings &settings = commonSettings();
// Add additional context menu settings // Add additional context menu settings
if (!settings.submitMessageCheckScript().isEmpty() if (!settings.submitMessageCheckScript().isEmpty()
|| !settings.nickNameMailMap.value().isEmpty()) { || !settings.nickNameMailMap().isEmpty()) {
auto sep = new QAction(this); auto sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
d->m_widget->addDescriptionEditContextMenuAction(sep); d->m_widget->addDescriptionEditContextMenuAction(sep);
@@ -186,7 +186,7 @@ void VcsBaseSubmitEditor::setParameters(const VcsBaseSubmitEditorParameters &par
d->m_widget->addDescriptionEditContextMenuAction(checkAction); d->m_widget->addDescriptionEditContextMenuAction(checkAction);
} }
// Insert nick // Insert nick
if (!settings.nickNameMailMap.value().isEmpty()) { if (!settings.nickNameMailMap().isEmpty()) {
auto insertAction = new QAction(Tr::tr("Insert Name..."), this); auto insertAction = new QAction(Tr::tr("Insert Name..."), this);
connect(insertAction, &QAction::triggered, this, &VcsBaseSubmitEditor::slotInsertNickName); connect(insertAction, &QAction::triggered, this, &VcsBaseSubmitEditor::slotInsertNickName);
d->m_widget->addDescriptionEditContextMenuAction(insertAction); d->m_widget->addDescriptionEditContextMenuAction(insertAction);