forked from qt-creator/qt-creator
Utils: Introduce a FilePathAspect::expandedValue()
Currently and long-term synonym for operator(), to be used in cases where (*this)() or such looks ugly. Change-Id: I3f70ecd3298a1df394a0e3cc593917b4c7d36d82 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -1325,12 +1325,17 @@ FilePathAspect::FilePathAspect(AspectContainer *container)
|
||||
|
||||
FilePath FilePathAspect::operator()() const
|
||||
{
|
||||
return filePath();
|
||||
return FilePath::fromUserInput(StringAspect::value());
|
||||
}
|
||||
|
||||
FilePath FilePathAspect::value() const
|
||||
{
|
||||
return filePath();
|
||||
return FilePath::fromUserInput(StringAspect::value());
|
||||
}
|
||||
|
||||
FilePath FilePathAspect::expandedValue() const
|
||||
{
|
||||
return FilePath::fromUserInput(StringAspect::value());
|
||||
}
|
||||
|
||||
QString FilePathAspect::stringValue() const
|
||||
|
@@ -537,6 +537,7 @@ public:
|
||||
|
||||
FilePath operator()() const;
|
||||
FilePath value() const;
|
||||
FilePath expandedValue() const;
|
||||
QString stringValue() const;
|
||||
void setValue(const FilePath &filePath);
|
||||
void setDefaultValue(const FilePath &filePath);
|
||||
|
@@ -74,12 +74,12 @@ void BuildDirectoryAspect::allowInSourceBuilds(const FilePath &sourceDir)
|
||||
{
|
||||
d->sourceDir = sourceDir;
|
||||
makeCheckable(CheckBoxPlacement::Top, Tr::tr("Shadow build:"), QString());
|
||||
setChecked(d->sourceDir != filePath());
|
||||
setChecked(d->sourceDir != expandedValue());
|
||||
}
|
||||
|
||||
bool BuildDirectoryAspect::isShadowBuild() const
|
||||
{
|
||||
return !d->sourceDir.isEmpty() && d->sourceDir != filePath();
|
||||
return !d->sourceDir.isEmpty() && d->sourceDir != expandedValue();
|
||||
}
|
||||
|
||||
void BuildDirectoryAspect::setProblem(const QString &description)
|
||||
@@ -92,7 +92,7 @@ void BuildDirectoryAspect::toMap(QVariantMap &map) const
|
||||
{
|
||||
FilePathAspect::toMap(map);
|
||||
if (!d->sourceDir.isEmpty()) {
|
||||
const FilePath shadowDir = isChecked() ? filePath() : d->savedShadowBuildDir;
|
||||
const FilePath shadowDir = isChecked() ? expandedValue() : d->savedShadowBuildDir;
|
||||
saveToMap(map, shadowDir.toSettings(), QString(), settingsKey() + ".shadowDir");
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ void BuildDirectoryAspect::fromMap(const QVariantMap &map)
|
||||
d->savedShadowBuildDir = FilePath::fromSettings(map.value(settingsKey() + ".shadowDir"));
|
||||
if (d->savedShadowBuildDir.isEmpty())
|
||||
setValue(d->sourceDir);
|
||||
setChecked(d->sourceDir != filePath());
|
||||
setChecked(d->sourceDir != expandedValue()); // FIXME: Check.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ void BuildDirectoryAspect::addToLayout(Layouting::LayoutItem &parent)
|
||||
setValue(d->savedShadowBuildDir.isEmpty()
|
||||
? d->sourceDir : d->savedShadowBuildDir);
|
||||
} else {
|
||||
d->savedShadowBuildDir = filePath();
|
||||
d->savedShadowBuildDir = expandedValue(); // FIXME: Check.
|
||||
setValue(d->sourceDir);
|
||||
}
|
||||
});
|
||||
|
@@ -632,8 +632,8 @@ void ExecutableAspect::makeOverridable(const QString &overridingKey, const QStri
|
||||
FilePath ExecutableAspect::executable() const
|
||||
{
|
||||
FilePath exe = m_alternativeExecutable && m_alternativeExecutable->isChecked()
|
||||
? m_alternativeExecutable->filePath()
|
||||
: m_executable.filePath();
|
||||
? (*m_alternativeExecutable)()
|
||||
: m_executable();
|
||||
|
||||
if (const IDevice::ConstPtr dev = executionDevice(m_target, m_selector))
|
||||
exe = dev->rootPath().withNewMappedPath(exe);
|
||||
|
@@ -230,7 +230,7 @@ void showAttachToProcessDialog()
|
||||
FilePath localExecutable = dlg.localExecutable();
|
||||
if (localExecutable.isEmpty()) {
|
||||
if (auto aspect = runConfig->aspect<SymbolFileAspect>())
|
||||
localExecutable = aspect->filePath();
|
||||
localExecutable = aspect->expandedValue();
|
||||
}
|
||||
|
||||
auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||
|
Reference in New Issue
Block a user