forked from qt-creator/qt-creator
Utils: Replace StringAspect::setFilePath()
... by FilePathAspect::setValue(). Closer to the intented uniform API. Task-number: QTCREATORBUG-29167 Change-Id: Ife26046eaeef2e49108e42a31a2d32e453883e3c Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -841,18 +841,6 @@ FilePath StringAspect::filePath() const
|
|||||||
return FilePath::fromUserInput(value());
|
return FilePath::fromUserInput(value());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the value of this string aspect to \a value.
|
|
||||||
|
|
||||||
\note This simply uses \c FilePath::toUserOutput() for the
|
|
||||||
conversion. It does not use any check that the value is actually
|
|
||||||
a file path.
|
|
||||||
*/
|
|
||||||
void StringAspect::setFilePath(const FilePath &value)
|
|
||||||
{
|
|
||||||
setValue(value.toUserOutput());
|
|
||||||
}
|
|
||||||
|
|
||||||
PathChooser *StringAspect::pathChooser() const
|
PathChooser *StringAspect::pathChooser() const
|
||||||
{
|
{
|
||||||
return d->m_pathChooserDisplay.data();
|
return d->m_pathChooserDisplay.data();
|
||||||
@@ -1324,6 +1312,13 @@ FilePathAspect::FilePathAspect(AspectContainer *container)
|
|||||||
setDisplayStyle(PathChooserDisplay);
|
setDisplayStyle(PathChooserDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets the value of this file path aspect to \a value.
|
||||||
|
|
||||||
|
\note This does not use any check that the value is actually
|
||||||
|
a file path.
|
||||||
|
*/
|
||||||
|
|
||||||
void FilePathAspect::setValue(const FilePath &filePath)
|
void FilePathAspect::setValue(const FilePath &filePath)
|
||||||
{
|
{
|
||||||
StringAspect::setValue(filePath.toUserOutput());
|
StringAspect::setValue(filePath.toUserOutput());
|
||||||
|
@@ -502,7 +502,6 @@ public:
|
|||||||
void toMap(QVariantMap &map) const override;
|
void toMap(QVariantMap &map) const override;
|
||||||
|
|
||||||
FilePath filePath() const;
|
FilePath filePath() const;
|
||||||
void setFilePath(const FilePath &value);
|
|
||||||
|
|
||||||
PathChooser *pathChooser() const; // Avoid to use.
|
PathChooser *pathChooser() const; // Avoid to use.
|
||||||
|
|
||||||
|
@@ -124,7 +124,7 @@ void AxivionSettings::fromSettings(QSettings *s)
|
|||||||
const QString curlPath = QStandardPaths::findExecutable(
|
const QString curlPath = QStandardPaths::findExecutable(
|
||||||
Utils::HostOsInfo::withExecutableSuffix("curl"));
|
Utils::HostOsInfo::withExecutableSuffix("curl"));
|
||||||
if (!curlPath.isEmpty())
|
if (!curlPath.isEmpty())
|
||||||
curl.setFilePath(Utils::FilePath::fromString(curlPath));
|
curl.setValue(Utils::FilePath::fromString(curlPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -92,7 +92,7 @@ QdbRunConfiguration::QdbRunConfiguration(Target *target, Id id)
|
|||||||
IDevice::ConstPtr dev = DeviceKitAspect::device(target->kit());
|
IDevice::ConstPtr dev = DeviceKitAspect::device(target->kit());
|
||||||
QTC_ASSERT(dev, return);
|
QTC_ASSERT(dev, return);
|
||||||
exeAspect->setExecutable(dev->filePath(depFile.remoteFilePath()));
|
exeAspect->setExecutable(dev->filePath(depFile.remoteFilePath()));
|
||||||
symbolsAspect->setFilePath(localExecutable);
|
symbolsAspect->setValue(localExecutable);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||||
|
@@ -2042,7 +2042,7 @@ BuildSystem *CMakeBuildConfiguration::buildSystem() const
|
|||||||
|
|
||||||
void CMakeBuildConfiguration::setSourceDirectory(const FilePath &path)
|
void CMakeBuildConfiguration::setSourceDirectory(const FilePath &path)
|
||||||
{
|
{
|
||||||
aspect<SourceDirectoryAspect>()->setFilePath(path);
|
aspect<SourceDirectoryAspect>()->setValue(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath CMakeBuildConfiguration::sourceDirectory() const
|
FilePath CMakeBuildConfiguration::sourceDirectory() const
|
||||||
|
@@ -72,7 +72,7 @@ ConanInstallStep::ConanInstallStep(BuildStepList *bsl, Id id)
|
|||||||
|
|
||||||
auto conanFile = addAspect<FilePathAspect>();
|
auto conanFile = addAspect<FilePathAspect>();
|
||||||
conanFile->setSettingsKey("ConanPackageManager.InstallStep.ConanFile");
|
conanFile->setSettingsKey("ConanPackageManager.InstallStep.ConanFile");
|
||||||
conanFile->setFilePath(conanFilePath(project(),
|
conanFile->setValue(conanFilePath(project(),
|
||||||
project()->projectDirectory() / "conanfile.txt"));
|
project()->projectDirectory() / "conanfile.txt"));
|
||||||
conanFile->setLabelText(Tr::tr("Conan file:"));
|
conanFile->setLabelText(Tr::tr("Conan file:"));
|
||||||
conanFile->setToolTip(Tr::tr("Enter location of conanfile.txt or conanfile.py."));
|
conanFile->setToolTip(Tr::tr("Enter location of conanfile.txt or conanfile.py."));
|
||||||
|
@@ -178,7 +178,7 @@ GitLabOptionsWidget::GitLabOptionsWidget(GitLabParameters *params)
|
|||||||
}, Column { m_add, m_edit, m_remove, st },
|
}, Column { m_add, m_edit, m_remove, st },
|
||||||
}.attachTo(this);
|
}.attachTo(this);
|
||||||
|
|
||||||
m_curl.setFilePath(params->curl);
|
m_curl.setValue(params->curl);
|
||||||
|
|
||||||
for (const auto &gitLabServer : params->gitLabServers) {
|
for (const auto &gitLabServer : params->gitLabServers) {
|
||||||
m_defaultGitLabServer->addItem(gitLabServer.displayString(),
|
m_defaultGitLabServer->addItem(gitLabServer.displayString(),
|
||||||
|
@@ -78,7 +78,7 @@ DeployMcuProcessStep::DeployMcuProcessStep(ProjectExplorer::BuildStepList *bc, U
|
|||||||
cmd->setSettingsKey("QmlProject.Mcu.ProcessStep.Command");
|
cmd->setSettingsKey("QmlProject.Mcu.ProcessStep.Command");
|
||||||
cmd->setExpectedKind(Utils::PathChooser::Command);
|
cmd->setExpectedKind(Utils::PathChooser::Command);
|
||||||
cmd->setLabelText(QmlProjectManager::Tr::tr("Command:"));
|
cmd->setLabelText(QmlProjectManager::Tr::tr("Command:"));
|
||||||
cmd->setFilePath(rootPath.pathAppended("/bin/qmlprojectexporter"));
|
cmd->setValue(rootPath.pathAppended("/bin/qmlprojectexporter"));
|
||||||
|
|
||||||
const char *importPathConstant = QtSupport::Constants::KIT_QML_IMPORT_PATH;
|
const char *importPathConstant = QtSupport::Constants::KIT_QML_IMPORT_PATH;
|
||||||
Utils::FilePath projectDir = buildSystem()->projectDirectory();
|
Utils::FilePath projectDir = buildSystem()->projectDirectory();
|
||||||
|
@@ -39,12 +39,12 @@ private:
|
|||||||
NimCompilerCleanStep::NimCompilerCleanStep(BuildStepList *parentList, Id id)
|
NimCompilerCleanStep::NimCompilerCleanStep(BuildStepList *parentList, Id id)
|
||||||
: BuildStep(parentList, id)
|
: BuildStep(parentList, id)
|
||||||
{
|
{
|
||||||
auto workingDirectory = addAspect<StringAspect>();
|
auto workingDirectory = addAspect<FilePathAspect>();
|
||||||
workingDirectory->setLabelText(Tr::tr("Working directory:"));
|
workingDirectory->setLabelText(Tr::tr("Working directory:"));
|
||||||
workingDirectory->setDisplayStyle(StringAspect::LineEditDisplay);
|
workingDirectory->setDisplayStyle(StringAspect::LineEditDisplay);
|
||||||
|
|
||||||
setSummaryUpdater([this, workingDirectory] {
|
setSummaryUpdater([this, workingDirectory] {
|
||||||
workingDirectory->setFilePath(buildDirectory());
|
workingDirectory->setValue(buildDirectory());
|
||||||
return displayName();
|
return displayName();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -102,7 +102,7 @@ void BuildDirectoryAspect::fromMap(const QVariantMap &map)
|
|||||||
if (!d->sourceDir.isEmpty()) {
|
if (!d->sourceDir.isEmpty()) {
|
||||||
d->savedShadowBuildDir = FilePath::fromSettings(map.value(settingsKey() + ".shadowDir"));
|
d->savedShadowBuildDir = FilePath::fromSettings(map.value(settingsKey() + ".shadowDir"));
|
||||||
if (d->savedShadowBuildDir.isEmpty())
|
if (d->savedShadowBuildDir.isEmpty())
|
||||||
setFilePath(d->sourceDir);
|
setValue(d->sourceDir);
|
||||||
setChecked(d->sourceDir != filePath());
|
setChecked(d->sourceDir != filePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,11 +117,11 @@ void BuildDirectoryAspect::addToLayout(Layouting::LayoutItem &parent)
|
|||||||
if (!d->sourceDir.isEmpty()) {
|
if (!d->sourceDir.isEmpty()) {
|
||||||
connect(this, &StringAspect::checkedChanged, this, [this] {
|
connect(this, &StringAspect::checkedChanged, this, [this] {
|
||||||
if (isChecked()) {
|
if (isChecked()) {
|
||||||
setFilePath(d->savedShadowBuildDir.isEmpty()
|
setValue(d->savedShadowBuildDir.isEmpty()
|
||||||
? d->sourceDir : d->savedShadowBuildDir);
|
? d->sourceDir : d->savedShadowBuildDir);
|
||||||
} else {
|
} else {
|
||||||
d->savedShadowBuildDir = filePath();
|
d->savedShadowBuildDir = filePath();
|
||||||
setFilePath(d->sourceDir);
|
setValue(d->sourceDir);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -246,10 +246,10 @@ void BuildConfiguration::setBuildDirectory(const FilePath &dir)
|
|||||||
{
|
{
|
||||||
if (dir == d->m_buildDirectoryAspect->filePath())
|
if (dir == d->m_buildDirectoryAspect->filePath())
|
||||||
return;
|
return;
|
||||||
d->m_buildDirectoryAspect->setFilePath(dir);
|
d->m_buildDirectoryAspect->setValue(dir);
|
||||||
const FilePath fixedDir = BuildDirectoryAspect::fixupDir(buildDirectory());
|
const FilePath fixedDir = BuildDirectoryAspect::fixupDir(buildDirectory());
|
||||||
if (!fixedDir.isEmpty())
|
if (!fixedDir.isEmpty())
|
||||||
d->m_buildDirectoryAspect->setFilePath(fixedDir);
|
d->m_buildDirectoryAspect->setValue(fixedDir);
|
||||||
emitBuildDirectoryChanged();
|
emitBuildDirectoryChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -252,7 +252,7 @@ Environment MakeStep::makeEnvironment() const
|
|||||||
|
|
||||||
void MakeStep::setMakeCommand(const FilePath &command)
|
void MakeStep::setMakeCommand(const FilePath &command)
|
||||||
{
|
{
|
||||||
m_makeCommandAspect.setFilePath(command);
|
m_makeCommandAspect.setValue(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MakeStep::defaultJobCount()
|
int MakeStep::defaultJobCount()
|
||||||
|
@@ -662,7 +662,7 @@ void ExecutableAspect::setPlaceHolderText(const QString &placeHolderText)
|
|||||||
*/
|
*/
|
||||||
void ExecutableAspect::setExecutable(const FilePath &executable)
|
void ExecutableAspect::setExecutable(const FilePath &executable)
|
||||||
{
|
{
|
||||||
m_executable.setFilePath(executable);
|
m_executable.setValue(executable);
|
||||||
m_executable.setShowToolTipOnLabel(true);
|
m_executable.setShowToolTipOnLabel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -190,7 +190,7 @@ private:
|
|||||||
ExecutionDeviceSelector m_selector = RunDevice;
|
ExecutionDeviceSelector m_selector = RunDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT SymbolFileAspect : public Utils::StringAspect
|
class PROJECTEXPLORER_EXPORT SymbolFileAspect : public Utils::FilePathAspect
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ PySideBuildStep::PySideBuildStep(BuildStepList *bsl, Id id)
|
|||||||
|
|
||||||
const FilePath pySideProjectPath = FilePath("pyside6-project").searchInPath();
|
const FilePath pySideProjectPath = FilePath("pyside6-project").searchInPath();
|
||||||
if (pySideProjectPath.isExecutableFile())
|
if (pySideProjectPath.isExecutableFile())
|
||||||
m_pysideProject.setFilePath(pySideProjectPath);
|
m_pysideProject.setValue(pySideProjectPath);
|
||||||
|
|
||||||
setCommandLineProvider([this] { return CommandLine(m_pysideProject(), {"build"}); });
|
setCommandLineProvider([this] { return CommandLine(m_pysideProject(), {"build"}); });
|
||||||
setWorkingDirectoryProvider([this] {
|
setWorkingDirectoryProvider([this] {
|
||||||
@@ -55,7 +55,7 @@ PySideBuildStep::PySideBuildStep(BuildStepList *bsl, Id id)
|
|||||||
|
|
||||||
void PySideBuildStep::updatePySideProjectPath(const FilePath &pySideProjectPath)
|
void PySideBuildStep::updatePySideProjectPath(const FilePath &pySideProjectPath)
|
||||||
{
|
{
|
||||||
m_pysideProject.setFilePath(pySideProjectPath);
|
m_pysideProject.setValue(pySideProjectPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PySideBuildStep::doRun()
|
void PySideBuildStep::doRun()
|
||||||
|
@@ -133,7 +133,7 @@ void PythonWizardPage::initializePage()
|
|||||||
const FilePath projectDir = FilePath::fromString(wiz->property("ProjectDirectory").toString());
|
const FilePath projectDir = FilePath::fromString(wiz->property("ProjectDirectory").toString());
|
||||||
m_createVenv.setValue(!projectDir.isEmpty());
|
m_createVenv.setValue(!projectDir.isEmpty());
|
||||||
if (m_venvPath.filePath().isEmpty())
|
if (m_venvPath.filePath().isEmpty())
|
||||||
m_venvPath.setFilePath(projectDir.isEmpty() ? FilePath{} : projectDir / "venv");
|
m_venvPath.setValue(projectDir.isEmpty() ? FilePath{} : projectDir / "venv");
|
||||||
|
|
||||||
updateInterpreters();
|
updateInterpreters();
|
||||||
updateStateLabel();
|
updateStateLabel();
|
||||||
|
@@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
Utils::BoolAspect flushEnabled;
|
Utils::BoolAspect flushEnabled;
|
||||||
Utils::IntegerAspect flushInterval;
|
Utils::IntegerAspect flushInterval;
|
||||||
Utils::StringAspect lastTraceFile;
|
Utils::FilePathAspect lastTraceFile;
|
||||||
Utils::BoolAspect aggregateTraces;
|
Utils::BoolAspect aggregateTraces;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -568,7 +568,7 @@ static void saveLastTraceFile(const FilePath &filePath)
|
|||||||
{
|
{
|
||||||
QmlProfilerSettings *settings = QmlProfilerPlugin::globalSettings();
|
QmlProfilerSettings *settings = QmlProfilerPlugin::globalSettings();
|
||||||
if (filePath != settings->lastTraceFile.filePath()) {
|
if (filePath != settings->lastTraceFile.filePath()) {
|
||||||
settings->lastTraceFile.setFilePath(filePath);
|
settings->lastTraceFile.setValue(filePath);
|
||||||
settings->writeGlobalSettings();
|
settings->writeGlobalSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -59,7 +59,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Id id)
|
|||||||
const DeployableFile depFile = target->deploymentData()
|
const DeployableFile depFile = target->deploymentData()
|
||||||
.deployableForLocalFile(localExecutable);
|
.deployableForLocalFile(localExecutable);
|
||||||
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||||
symbolsAspect->setFilePath(localExecutable);
|
symbolsAspect->setValue(localExecutable);
|
||||||
});
|
});
|
||||||
|
|
||||||
setRunnableModifier([libAspect](Runnable &r) {
|
setRunnableModifier([libAspect](Runnable &r) {
|
||||||
|
@@ -101,7 +101,7 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent
|
|||||||
installRootAspect->setSettingsKey(InstallRootAspectId);
|
installRootAspect->setSettingsKey(InstallRootAspectId);
|
||||||
installRootAspect->setExpectedKind(PathChooser::Directory);
|
installRootAspect->setExpectedKind(PathChooser::Directory);
|
||||||
installRootAspect->setLabelText(Tr::tr("Install root:"));
|
installRootAspect->setLabelText(Tr::tr("Install root:"));
|
||||||
installRootAspect->setFilePath(rootPath);
|
installRootAspect->setValue(rootPath);
|
||||||
connect(installRootAspect, &StringAspect::changed,
|
connect(installRootAspect, &StringAspect::changed,
|
||||||
this, &MakeInstallStep::updateArgsFromAspect);
|
this, &MakeInstallStep::updateArgsFromAspect);
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id)
|
|||||||
const DeployableFile depFile = deploymentData.deployableForLocalFile(localExecutable);
|
const DeployableFile depFile = deploymentData.deployableForLocalFile(localExecutable);
|
||||||
|
|
||||||
exeAspect->setExecutable(runDevice->filePath(depFile.remoteFilePath()));
|
exeAspect->setExecutable(runDevice->filePath(depFile.remoteFilePath()));
|
||||||
symbolsAspect->setFilePath(localExecutable);
|
symbolsAspect->setValue(localExecutable);
|
||||||
libAspect->setEnabled(buildDevice == runDevice);
|
libAspect->setEnabled(buildDevice == runDevice);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -70,7 +70,7 @@ void SuppressionAspectPrivate::slotAddSuppression()
|
|||||||
if (!files.isEmpty()) {
|
if (!files.isEmpty()) {
|
||||||
for (const FilePath &file : files)
|
for (const FilePath &file : files)
|
||||||
m_model.appendRow(new QStandardItem(file.toString()));
|
m_model.appendRow(new QStandardItem(file.toString()));
|
||||||
conf->lastSuppressionDirectory.setFilePath(files.at(0).absolutePath());
|
conf->lastSuppressionDirectory.setValue(files.at(0).absolutePath());
|
||||||
//conf->setLastSuppressionDialogHistory(dialog.history());
|
//conf->setLastSuppressionDialogHistory(dialog.history());
|
||||||
if (!isGlobal)
|
if (!isGlobal)
|
||||||
q->apply();
|
q->apply();
|
||||||
|
@@ -120,7 +120,7 @@ public:
|
|||||||
void writeSettings() const;
|
void writeSettings() const;
|
||||||
void readSettings();
|
void readSettings();
|
||||||
|
|
||||||
Utils::StringAspect lastSuppressionDirectory{this};
|
Utils::FilePathAspect lastSuppressionDirectory{this};
|
||||||
Utils::StringAspect lastSuppressionHistory{this};
|
Utils::StringAspect lastSuppressionHistory{this};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user