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());
|
||||
}
|
||||
|
||||
/*!
|
||||
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
|
||||
{
|
||||
return d->m_pathChooserDisplay.data();
|
||||
@@ -1324,6 +1312,13 @@ FilePathAspect::FilePathAspect(AspectContainer *container)
|
||||
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)
|
||||
{
|
||||
StringAspect::setValue(filePath.toUserOutput());
|
||||
|
@@ -502,7 +502,6 @@ public:
|
||||
void toMap(QVariantMap &map) const override;
|
||||
|
||||
FilePath filePath() const;
|
||||
void setFilePath(const FilePath &value);
|
||||
|
||||
PathChooser *pathChooser() const; // Avoid to use.
|
||||
|
||||
|
@@ -124,7 +124,7 @@ void AxivionSettings::fromSettings(QSettings *s)
|
||||
const QString curlPath = QStandardPaths::findExecutable(
|
||||
Utils::HostOsInfo::withExecutableSuffix("curl"));
|
||||
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());
|
||||
QTC_ASSERT(dev, return);
|
||||
exeAspect->setExecutable(dev->filePath(depFile.remoteFilePath()));
|
||||
symbolsAspect->setFilePath(localExecutable);
|
||||
symbolsAspect->setValue(localExecutable);
|
||||
});
|
||||
|
||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||
|
@@ -2042,7 +2042,7 @@ BuildSystem *CMakeBuildConfiguration::buildSystem() const
|
||||
|
||||
void CMakeBuildConfiguration::setSourceDirectory(const FilePath &path)
|
||||
{
|
||||
aspect<SourceDirectoryAspect>()->setFilePath(path);
|
||||
aspect<SourceDirectoryAspect>()->setValue(path);
|
||||
}
|
||||
|
||||
FilePath CMakeBuildConfiguration::sourceDirectory() const
|
||||
|
@@ -72,7 +72,7 @@ ConanInstallStep::ConanInstallStep(BuildStepList *bsl, Id id)
|
||||
|
||||
auto conanFile = addAspect<FilePathAspect>();
|
||||
conanFile->setSettingsKey("ConanPackageManager.InstallStep.ConanFile");
|
||||
conanFile->setFilePath(conanFilePath(project(),
|
||||
conanFile->setValue(conanFilePath(project(),
|
||||
project()->projectDirectory() / "conanfile.txt"));
|
||||
conanFile->setLabelText(Tr::tr("Conan file:"));
|
||||
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 },
|
||||
}.attachTo(this);
|
||||
|
||||
m_curl.setFilePath(params->curl);
|
||||
m_curl.setValue(params->curl);
|
||||
|
||||
for (const auto &gitLabServer : params->gitLabServers) {
|
||||
m_defaultGitLabServer->addItem(gitLabServer.displayString(),
|
||||
|
@@ -78,7 +78,7 @@ DeployMcuProcessStep::DeployMcuProcessStep(ProjectExplorer::BuildStepList *bc, U
|
||||
cmd->setSettingsKey("QmlProject.Mcu.ProcessStep.Command");
|
||||
cmd->setExpectedKind(Utils::PathChooser::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;
|
||||
Utils::FilePath projectDir = buildSystem()->projectDirectory();
|
||||
|
@@ -39,12 +39,12 @@ private:
|
||||
NimCompilerCleanStep::NimCompilerCleanStep(BuildStepList *parentList, Id id)
|
||||
: BuildStep(parentList, id)
|
||||
{
|
||||
auto workingDirectory = addAspect<StringAspect>();
|
||||
auto workingDirectory = addAspect<FilePathAspect>();
|
||||
workingDirectory->setLabelText(Tr::tr("Working directory:"));
|
||||
workingDirectory->setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
|
||||
setSummaryUpdater([this, workingDirectory] {
|
||||
workingDirectory->setFilePath(buildDirectory());
|
||||
workingDirectory->setValue(buildDirectory());
|
||||
return displayName();
|
||||
});
|
||||
}
|
||||
|
@@ -102,7 +102,7 @@ void BuildDirectoryAspect::fromMap(const QVariantMap &map)
|
||||
if (!d->sourceDir.isEmpty()) {
|
||||
d->savedShadowBuildDir = FilePath::fromSettings(map.value(settingsKey() + ".shadowDir"));
|
||||
if (d->savedShadowBuildDir.isEmpty())
|
||||
setFilePath(d->sourceDir);
|
||||
setValue(d->sourceDir);
|
||||
setChecked(d->sourceDir != filePath());
|
||||
}
|
||||
}
|
||||
@@ -117,11 +117,11 @@ void BuildDirectoryAspect::addToLayout(Layouting::LayoutItem &parent)
|
||||
if (!d->sourceDir.isEmpty()) {
|
||||
connect(this, &StringAspect::checkedChanged, this, [this] {
|
||||
if (isChecked()) {
|
||||
setFilePath(d->savedShadowBuildDir.isEmpty()
|
||||
setValue(d->savedShadowBuildDir.isEmpty()
|
||||
? d->sourceDir : d->savedShadowBuildDir);
|
||||
} else {
|
||||
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())
|
||||
return;
|
||||
d->m_buildDirectoryAspect->setFilePath(dir);
|
||||
d->m_buildDirectoryAspect->setValue(dir);
|
||||
const FilePath fixedDir = BuildDirectoryAspect::fixupDir(buildDirectory());
|
||||
if (!fixedDir.isEmpty())
|
||||
d->m_buildDirectoryAspect->setFilePath(fixedDir);
|
||||
d->m_buildDirectoryAspect->setValue(fixedDir);
|
||||
emitBuildDirectoryChanged();
|
||||
}
|
||||
|
||||
|
@@ -252,7 +252,7 @@ Environment MakeStep::makeEnvironment() const
|
||||
|
||||
void MakeStep::setMakeCommand(const FilePath &command)
|
||||
{
|
||||
m_makeCommandAspect.setFilePath(command);
|
||||
m_makeCommandAspect.setValue(command);
|
||||
}
|
||||
|
||||
int MakeStep::defaultJobCount()
|
||||
|
@@ -662,7 +662,7 @@ void ExecutableAspect::setPlaceHolderText(const QString &placeHolderText)
|
||||
*/
|
||||
void ExecutableAspect::setExecutable(const FilePath &executable)
|
||||
{
|
||||
m_executable.setFilePath(executable);
|
||||
m_executable.setValue(executable);
|
||||
m_executable.setShowToolTipOnLabel(true);
|
||||
}
|
||||
|
||||
|
@@ -190,7 +190,7 @@ private:
|
||||
ExecutionDeviceSelector m_selector = RunDevice;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT SymbolFileAspect : public Utils::StringAspect
|
||||
class PROJECTEXPLORER_EXPORT SymbolFileAspect : public Utils::FilePathAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@@ -42,7 +42,7 @@ PySideBuildStep::PySideBuildStep(BuildStepList *bsl, Id id)
|
||||
|
||||
const FilePath pySideProjectPath = FilePath("pyside6-project").searchInPath();
|
||||
if (pySideProjectPath.isExecutableFile())
|
||||
m_pysideProject.setFilePath(pySideProjectPath);
|
||||
m_pysideProject.setValue(pySideProjectPath);
|
||||
|
||||
setCommandLineProvider([this] { return CommandLine(m_pysideProject(), {"build"}); });
|
||||
setWorkingDirectoryProvider([this] {
|
||||
@@ -55,7 +55,7 @@ PySideBuildStep::PySideBuildStep(BuildStepList *bsl, Id id)
|
||||
|
||||
void PySideBuildStep::updatePySideProjectPath(const FilePath &pySideProjectPath)
|
||||
{
|
||||
m_pysideProject.setFilePath(pySideProjectPath);
|
||||
m_pysideProject.setValue(pySideProjectPath);
|
||||
}
|
||||
|
||||
void PySideBuildStep::doRun()
|
||||
|
@@ -133,7 +133,7 @@ void PythonWizardPage::initializePage()
|
||||
const FilePath projectDir = FilePath::fromString(wiz->property("ProjectDirectory").toString());
|
||||
m_createVenv.setValue(!projectDir.isEmpty());
|
||||
if (m_venvPath.filePath().isEmpty())
|
||||
m_venvPath.setFilePath(projectDir.isEmpty() ? FilePath{} : projectDir / "venv");
|
||||
m_venvPath.setValue(projectDir.isEmpty() ? FilePath{} : projectDir / "venv");
|
||||
|
||||
updateInterpreters();
|
||||
updateStateLabel();
|
||||
|
@@ -18,7 +18,7 @@ public:
|
||||
|
||||
Utils::BoolAspect flushEnabled;
|
||||
Utils::IntegerAspect flushInterval;
|
||||
Utils::StringAspect lastTraceFile;
|
||||
Utils::FilePathAspect lastTraceFile;
|
||||
Utils::BoolAspect aggregateTraces;
|
||||
};
|
||||
|
||||
|
@@ -568,7 +568,7 @@ static void saveLastTraceFile(const FilePath &filePath)
|
||||
{
|
||||
QmlProfilerSettings *settings = QmlProfilerPlugin::globalSettings();
|
||||
if (filePath != settings->lastTraceFile.filePath()) {
|
||||
settings->lastTraceFile.setFilePath(filePath);
|
||||
settings->lastTraceFile.setValue(filePath);
|
||||
settings->writeGlobalSettings();
|
||||
}
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Id id)
|
||||
const DeployableFile depFile = target->deploymentData()
|
||||
.deployableForLocalFile(localExecutable);
|
||||
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||
symbolsAspect->setFilePath(localExecutable);
|
||||
symbolsAspect->setValue(localExecutable);
|
||||
});
|
||||
|
||||
setRunnableModifier([libAspect](Runnable &r) {
|
||||
|
@@ -101,7 +101,7 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent
|
||||
installRootAspect->setSettingsKey(InstallRootAspectId);
|
||||
installRootAspect->setExpectedKind(PathChooser::Directory);
|
||||
installRootAspect->setLabelText(Tr::tr("Install root:"));
|
||||
installRootAspect->setFilePath(rootPath);
|
||||
installRootAspect->setValue(rootPath);
|
||||
connect(installRootAspect, &StringAspect::changed,
|
||||
this, &MakeInstallStep::updateArgsFromAspect);
|
||||
|
||||
|
@@ -69,7 +69,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id)
|
||||
const DeployableFile depFile = deploymentData.deployableForLocalFile(localExecutable);
|
||||
|
||||
exeAspect->setExecutable(runDevice->filePath(depFile.remoteFilePath()));
|
||||
symbolsAspect->setFilePath(localExecutable);
|
||||
symbolsAspect->setValue(localExecutable);
|
||||
libAspect->setEnabled(buildDevice == runDevice);
|
||||
});
|
||||
|
||||
|
@@ -70,7 +70,7 @@ void SuppressionAspectPrivate::slotAddSuppression()
|
||||
if (!files.isEmpty()) {
|
||||
for (const FilePath &file : files)
|
||||
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());
|
||||
if (!isGlobal)
|
||||
q->apply();
|
||||
|
@@ -120,7 +120,7 @@ public:
|
||||
void writeSettings() const;
|
||||
void readSettings();
|
||||
|
||||
Utils::StringAspect lastSuppressionDirectory{this};
|
||||
Utils::FilePathAspect lastSuppressionDirectory{this};
|
||||
Utils::StringAspect lastSuppressionHistory{this};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user