forked from qt-creator/qt-creator
Utils: Further split StringAspect and FilePathAspect
... by introducing "proper" FilePathAspect::value() (and therefore hiding the inherited StringAspect::value(() and a temporary stringValue() for the transition period for the remaining users of the QString value. Change-Id: I40cf4238a09a9009cda0decba1acac82bd730233 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -1327,6 +1327,21 @@ FilePathAspect::FilePathAspect(AspectContainer *container)
|
|||||||
setDisplayStyle(PathChooserDisplay);
|
setDisplayStyle(PathChooserDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePath FilePathAspect::operator()() const
|
||||||
|
{
|
||||||
|
return filePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
FilePath FilePathAspect::value() const
|
||||||
|
{
|
||||||
|
return filePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString FilePathAspect::stringValue() const
|
||||||
|
{
|
||||||
|
return StringAspect::value();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the value of this file path aspect to \a value.
|
Sets the value of this file path aspect to \a value.
|
||||||
|
|
||||||
|
@@ -518,7 +518,9 @@ class QTCREATOR_UTILS_EXPORT FilePathAspect : public StringAspect
|
|||||||
public:
|
public:
|
||||||
FilePathAspect(AspectContainer *container = nullptr);
|
FilePathAspect(AspectContainer *container = nullptr);
|
||||||
|
|
||||||
FilePath operator()() const { return filePath(); }
|
FilePath operator()() const;
|
||||||
|
FilePath value() const;
|
||||||
|
QString stringValue() const;
|
||||||
void setValue(const FilePath &filePath);
|
void setValue(const FilePath &filePath);
|
||||||
void setDefaultValue(const FilePath &filePath);
|
void setDefaultValue(const FilePath &filePath);
|
||||||
|
|
||||||
|
@@ -766,7 +766,7 @@ unsigned int FossilClient::binaryVersion() const
|
|||||||
static unsigned int cachedBinaryVersion = 0;
|
static unsigned int cachedBinaryVersion = 0;
|
||||||
static QString cachedBinaryPath;
|
static QString cachedBinaryPath;
|
||||||
|
|
||||||
const QString currentBinaryPath = settings().binaryPath.value();
|
const QString currentBinaryPath = settings().binaryPath.stringValue();
|
||||||
|
|
||||||
if (currentBinaryPath.isEmpty())
|
if (currentBinaryPath.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -58,7 +58,7 @@ QString FossilJsExtension::defaultSslIdentityFile() const
|
|||||||
if (!isConfigured())
|
if (!isConfigured())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
return settings().sslIdentityFile.value();
|
return settings().sslIdentityFile.stringValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
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.value();
|
return settings().defaultRepoPath.stringValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FossilJsExtension::defaultDisableAutosync() const
|
bool FossilJsExtension::defaultDisableAutosync() const
|
||||||
|
@@ -170,7 +170,7 @@ FilePath GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
|
|||||||
*ok = false;
|
*ok = false;
|
||||||
if (errorMessage)
|
if (errorMessage)
|
||||||
*errorMessage = Tr::tr("The binary \"%1\" could not be located in the path \"%2\"")
|
*errorMessage = Tr::tr("The binary \"%1\" could not be located in the path \"%2\"")
|
||||||
.arg(binaryPath.value(), path().toUserOutput());
|
.arg(binaryPath().toUserOutput(), path().toUserOutput());
|
||||||
}
|
}
|
||||||
return resolvedBinPath;
|
return resolvedBinPath;
|
||||||
}
|
}
|
||||||
|
@@ -41,10 +41,10 @@ class NimPluginPrivate
|
|||||||
public:
|
public:
|
||||||
NimPluginPrivate()
|
NimPluginPrivate()
|
||||||
{
|
{
|
||||||
Suggest::NimSuggestCache::instance().setExecutablePath(settings.nimSuggestPath.value());
|
Suggest::NimSuggestCache::instance().setExecutablePath(settings.nimSuggestPath.stringValue());
|
||||||
QObject::connect(&settings.nimSuggestPath, &StringAspect::changed,
|
QObject::connect(&settings.nimSuggestPath, &StringAspect::changed,
|
||||||
&Suggest::NimSuggestCache::instance(), [this] {
|
&Suggest::NimSuggestCache::instance(), [this] {
|
||||||
Suggest::NimSuggestCache::instance().setExecutablePath(settings.nimSuggestPath.value());
|
Suggest::NimSuggestCache::instance().setExecutablePath(settings.nimSuggestPath.stringValue());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ BuildDirectoryAspect::BuildDirectoryAspect(AspectContainer *container, const Bui
|
|||||||
});
|
});
|
||||||
|
|
||||||
setOpenTerminalHandler([this, bc] {
|
setOpenTerminalHandler([this, bc] {
|
||||||
Core::FileUtils::openTerminal(FilePath::fromString(value()), bc->environment());
|
Core::FileUtils::openTerminal(value(), bc->environment());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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.value().trimmed()));
|
environment().expandVariables(d->m_buildDirectoryAspect.stringValue().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?
|
||||||
|
@@ -38,7 +38,7 @@ VcsBaseSettings::~VcsBaseSettings() = default;
|
|||||||
|
|
||||||
FilePaths VcsBaseSettings::searchPathList() const
|
FilePaths VcsBaseSettings::searchPathList() const
|
||||||
{
|
{
|
||||||
return Utils::transform(path.value().split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts),
|
return Utils::transform(path.stringValue().split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts),
|
||||||
&FilePath::fromUserInput);
|
&FilePath::fromUserInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user